diff --git a/src/control/Control.Attribution.ts b/src/control/Control.Attribution.ts index 33b986c613..c5098ff288 100644 --- a/src/control/Control.Attribution.ts +++ b/src/control/Control.Attribution.ts @@ -47,6 +47,7 @@ const layerEvents = 'addlayer removelayer setbaselayer baselayerremove'; */ class Attribution extends Control { options: AttributionOptionsType; + //@interlal _attributionContainer: HTMLDivElement; buildOn() { @@ -65,6 +66,7 @@ class Attribution extends Control { this.getMap().off(layerEvents, this._update, this); } + //@interlal _update() { const map = this.getMap(); if (!map) { diff --git a/src/control/Control.Compass.ts b/src/control/Control.Compass.ts index 86dcdeb7db..0ecc915bd1 100644 --- a/src/control/Control.Compass.ts +++ b/src/control/Control.Compass.ts @@ -22,7 +22,9 @@ const options = { class Compass extends Control { options: CompassOptionsType; + //@interlal _compass: HTMLDivElement; + //@interlal _bearing: number; /** * method to build DOM of the control @@ -45,15 +47,18 @@ class Compass extends Control { this._rotateCompass(); } + //@interlal _getCompass() { const compass = createEl('div', 'maptalks-compass'); return compass; } + //@interlal _registerDomEvents() { on(this._compass, 'click', this._resetView, this); } + //@interlal _rotateCompass() { const b = this.getMap().getBearing().toFixed(1); let bearing = parseFloat(b); @@ -73,6 +78,7 @@ class Compass extends Control { delete this._bearing; } + //@interlal _resetView() { const view = { bearing: 0 }; this.getMap().animateTo(view); @@ -96,4 +102,4 @@ export default Compass; export type CompassOptionsType = { position: string | DomPositionType; -} & ControlOptionsType; \ No newline at end of file +} & ControlOptionsType; diff --git a/src/control/Control.LayerSwitcher.ts b/src/control/Control.LayerSwitcher.ts index 0de3a3ea7c..c160738d8e 100644 --- a/src/control/Control.LayerSwitcher.ts +++ b/src/control/Control.LayerSwitcher.ts @@ -71,6 +71,7 @@ class LayerSwitcher extends Control { } } + //@interlal _show() { if (!hasClass(this.container, 'shown')) { addClass(this.container, 'shown'); @@ -78,12 +79,14 @@ class LayerSwitcher extends Control { } } + //@interlal _hide(e) { if (!this.panel.contains(e.toElement || e.relatedTarget)) { setClass(this.container, this.options['containerClass']); } } + //@interlal _createPanel() { this.panel.innerHTML = ''; const ul = createEl('ul'); @@ -91,6 +94,7 @@ class LayerSwitcher extends Control { this._renderLayers(this.getMap(), ul); } + //@interlal _renderLayers(map: Map, elm: HTMLElement) { const base = map.getBaseLayer(), layers = map.getLayers(), @@ -199,12 +203,14 @@ class LayerSwitcher extends Control { } } + //@interlal _isExcluded(layer: Layer) { const id = layer.getId(), excludeLayers = this.options['excludeLayers']; return !(excludeLayers.length && excludeLayers.indexOf(id) >= 0); } + //@interlal _renderLayer(layer, isBase?: boolean, parentChecked = true) { const li = createEl('li', 'layer'), label = createEl('label'), @@ -238,8 +244,8 @@ class LayerSwitcher extends Control { baseLayers = (baseLayer as any).layers; if (baseLayers) { for (let i = 0, len = baseLayers.length; i < len; i++) { - const _baseLayer = baseLayers[i]; - _baseLayer[_baseLayer === layer ? 'show' : 'hide'](); + const childLayer = baseLayers[i]; + childLayer[childLayer === layer ? 'show' : 'hide'](); } } else if (!baseLayer.isVisible()) { baseLayer.show(); diff --git a/src/control/Control.Overview.ts b/src/control/Control.Overview.ts index 9bffec9f07..5694a70320 100644 --- a/src/control/Control.Overview.ts +++ b/src/control/Control.Overview.ts @@ -55,7 +55,9 @@ class Overview extends Control { options: OverviewOptionsType; mapContainer: HTMLDivElement; button: HTMLDivElement; + //@interlal _overview: Map; + //@interlal _perspective: Polygon; /** @@ -143,6 +145,7 @@ class Overview extends Control { return this._overview; } + //@interlal _onButtonClick() { if (!this._overview) { this.maxmize(); @@ -152,6 +155,7 @@ class Overview extends Control { this._updateButtonText(); } + //@interlal _updateButtonText() { if (this._overview) { this.button.innerHTML = '-'; @@ -160,6 +164,7 @@ class Overview extends Control { } } + //@interlal _createOverview() { const map = this.getMap(), dom = this.mapContainer; @@ -190,6 +195,7 @@ class Overview extends Control { this.fire('load'); } + //@interlal _getOverviewZoom() { const map = this.getMap(), zoom = map.getZoom(), @@ -213,12 +219,14 @@ class Overview extends Control { } + //@interlal _onDragEnd() { const center = this._perspective.getCenter(); this._overview.setCenter(center); this.getMap().panTo(center); } + //@interlal _getPerspectiveCoords() { const map = this.getMap(); const projection = map.getProjection(); @@ -232,6 +240,7 @@ class Overview extends Control { }); } + //@interlal _update() { if (!this._overview) { return; @@ -243,6 +252,7 @@ class Overview extends Control { this._overview.setCenterAndZoom(this.getMap().getCenter(), this._getOverviewZoom()); } + //@interlal _updateSpatialReference() { if (!this._overview) { return; @@ -252,6 +262,7 @@ class Overview extends Control { this._overview.setSpatialReference(spatialRef); } + //@interlal _updateBaseLayer() { if (!this._overview) { return; diff --git a/src/control/Control.Panel.ts b/src/control/Control.Panel.ts index 1998f18737..26bc702a0d 100644 --- a/src/control/Control.Panel.ts +++ b/src/control/Control.Panel.ts @@ -40,7 +40,9 @@ const options: PanelOptionsType = { class Panel extends Control { draggable: DragHandler; options: PanelOptionsType; + //@interlal _startPos: Point; + //@interlal _startPosition: DomPositionType; /** @@ -146,6 +148,7 @@ class Panel extends Control { return this.options['content']; } + //@interlal _cancelOn(domEvent) { const target = domEvent.srcElement || domEvent.target, tagName = target.tagName.toLowerCase(); @@ -159,6 +162,7 @@ class Panel extends Control { return false; } + //@interlal _onDragStart(param) { this._startPos = param['mousePos']; this._startPosition = extend({}, this.getPosition()); @@ -174,6 +178,7 @@ class Panel extends Control { this.fire('dragstart', param); } + //@interlal _onDragging(param) { const pos = param['mousePos']; const offset = pos.sub(this._startPos); @@ -205,6 +210,7 @@ class Panel extends Control { this.fire('dragging', param); } + //@interlal _onDragEnd(param) { delete this._startPos; delete this._startPosition; @@ -224,6 +230,7 @@ class Panel extends Control { * Get the connect points of panel for connector lines. * @private */ + //@interlal _getConnectPoints() { const map = this.getMap(); const containerPoint = this.getContainerPoint(); diff --git a/src/control/Control.Reset.ts b/src/control/Control.Reset.ts index 8a96901966..ee66f5379a 100644 --- a/src/control/Control.Reset.ts +++ b/src/control/Control.Reset.ts @@ -22,7 +22,9 @@ const options: ResetOptionsType = { }; class Reset extends Control { + //@interlal _reset: HTMLDivElement; + //@interlal _view: MapViewType; options: ResetOptionsType; /** @@ -48,11 +50,13 @@ class Reset extends Control { this._view = view; } + //@interlal _getReset() { const reset = createEl('div', 'maptalks-reset'); return reset as HTMLDivElement; } + //@interlal _registerDomEvents() { on(this._reset, 'click', this._resetView, this); } @@ -62,6 +66,7 @@ class Reset extends Control { delete this._view; } + //@interlal _resetView() { this.getMap().setView(this._view); } diff --git a/src/control/Control.Scale.ts b/src/control/Control.Scale.ts index 1012009048..ca04fd21dc 100644 --- a/src/control/Control.Scale.ts +++ b/src/control/Control.Scale.ts @@ -38,8 +38,11 @@ const options: ScaleOptionsType = { const EVENTS_TO_LISTEN = 'zoomend moving moveend'; class Scale extends Control { + //@interlal _scaleContainer: HTMLDivElement; + //@interlal _mScale: HTMLDivElement; + //@interlal _iScale: HTMLDivElement; options: ScaleOptionsType; @@ -64,6 +67,7 @@ class Scale extends Control { this.getMap().off(EVENTS_TO_LISTEN, this._update, this); } + //@interlal _addScales() { const css = 'border: 2px solid #000000;border-top: none;line-height: 1.1;padding: 0px;' + 'color: #000000;font-size: 11px;text-align:center;white-space: nowrap;overflow: hidden' + @@ -76,12 +80,14 @@ class Scale extends Control { } } + //@interlal _update() { const map = this._map; const maxMeters = map.pixelToDistance(this.options['maxWidth'], 0); this._updateScales(maxMeters); } + //@interlal _updateScales(maxMeters: number) { if (this.options['metric'] && maxMeters) { this._updateMetric(maxMeters); @@ -91,6 +97,7 @@ class Scale extends Control { } } + //@interlal _updateMetric(maxMeters: number) { const meters = this._getRoundNum(maxMeters), label = meters < 1000 ? meters + ' m' : (meters / 1000) + ' km'; @@ -98,6 +105,7 @@ class Scale extends Control { this._updateScale(this._mScale, label, meters / maxMeters); } + //@interlal _updateImperial(maxMeters: number) { const maxFeet = maxMeters * 3.2808399; let maxMiles, miles, feet; @@ -113,11 +121,13 @@ class Scale extends Control { } } + //@interlal _updateScale(scale: HTMLDivElement, text: string, ratio: number) { scale['style']['width'] = Math.round(this.options['maxWidth'] * ratio) + 'px'; scale['innerHTML'] = text; } + //@interlal _getRoundNum(num: number) { const pow10 = Math.pow(10, (Math.floor(num) + '').length - 1); let d = num / pow10; diff --git a/src/control/Control.Toolbar.ts b/src/control/Control.Toolbar.ts index 521ecc440e..cdf3e44aab 100644 --- a/src/control/Control.Toolbar.ts +++ b/src/control/Control.Toolbar.ts @@ -119,6 +119,7 @@ class Toolbar extends Control { return dom; } + //@interlal _createDropMenu(index: number) { const me = this; @@ -180,6 +181,7 @@ class Toolbar extends Control { return menuDom; } + //@interlal _getItems() { return this.options['items'] || []; } diff --git a/src/control/Control.Zoom.ts b/src/control/Control.Zoom.ts index c90aba84d4..20cdd4602e 100644 --- a/src/control/Control.Zoom.ts +++ b/src/control/Control.Zoom.ts @@ -35,8 +35,11 @@ const options: ZoomOptionsType = { */ class Zoom extends Control { options: ZoomOptionsType; + //@interlal _levelDOM: HTMLSpanElement; + //@interlal _zoomInButton: HTMLLinkElement; + //@interlal _zoomOutButton: HTMLLinkElement; /** * method to build DOM of the control @@ -109,6 +112,7 @@ class Zoom extends Control { // } } + //@interlal _update() { // const map = this.getMap(); // if (this._sliderBox) { @@ -124,6 +128,7 @@ class Zoom extends Control { this._updateText(); } + //@interlal _updateText() { if (this._levelDOM) { const map = this.getMap(); @@ -135,6 +140,7 @@ class Zoom extends Control { } } + //@interlal _registerDomEvents() { if (this._zoomInButton) { on(this._zoomInButton, 'click', this._onZoomInClick, this); @@ -153,11 +159,13 @@ class Zoom extends Control { // } } + //@interlal _onZoomInClick(e) { preventDefault(e); this.getMap().zoomIn(); } + //@interlal _onZoomOutClick(e) { preventDefault(e); this.getMap().zoomOut(); diff --git a/src/control/Control.ts b/src/control/Control.ts index f8a0bfe4a9..4421d63971 100644 --- a/src/control/Control.ts +++ b/src/control/Control.ts @@ -17,8 +17,11 @@ import Map from '../map/Map'; abstract class Control extends Eventable(Class) { + //@interlal _map: Map; + //@interlal __ctrlContainer: HTMLElement; + //@interlal _controlDom: HTMLElement; options: ControlOptionsType; static positions: { [key: string]: DomPositionType }; @@ -43,6 +46,7 @@ abstract class Control extends Eventable(Class) { super(options); } + //@interlal _appendCustomClass(dom: HTMLElement) { if (!dom) { console.warn('dom is null:', dom); @@ -244,6 +248,7 @@ abstract class Control extends Eventable(Class) { return this; } + //@interlal _parse(position: ControlPositionType): DomPositionType { let p = position; if (isString(position)) { @@ -252,6 +257,7 @@ abstract class Control extends Eventable(Class) { return p as DomPositionType; } + //@interlal _updatePosition() { let position = this.getPosition(); if (!position) { diff --git a/src/core/Ajax.ts b/src/core/Ajax.ts index f435d73c73..4e2a484eed 100644 --- a/src/core/Ajax.ts +++ b/src/core/Ajax.ts @@ -168,6 +168,7 @@ const Ajax = { return client; }, + //@interlal _wrapCallback: function (client, cb: Callback) { return function () { if (client.readyState === 4) { @@ -194,6 +195,7 @@ const Ajax = { }; }, + //@interlal _getClient: function (cb: Callback) { /*eslint-disable no-empty, no-undef*/ let client; diff --git a/src/core/Animation.ts b/src/core/Animation.ts index 8a889a4cd3..c736051eff 100644 --- a/src/core/Animation.ts +++ b/src/core/Animation.ts @@ -115,17 +115,21 @@ class Frame { * @memberof animation */ class Player { + //@interlal _animation: AnimationCallback options: AnimationOptionsPrivateType + //@interlal _onFrame: (frame: Frame) => void; playState: string ready: boolean finished: boolean target: any; duration: number; + //@interlal _framer: (cb: AnimationCallback) => void; currentTime: number; startTime: number; + //@interlal _playStartTime: number; /** @@ -144,6 +148,7 @@ class Player { this.target = target; } + //@interlal _prepare() { const options = this.options; let duration = options['speed'] || options['duration']; @@ -234,6 +239,7 @@ class Player { reverse() { } + //@interlal _run() { const onFrame = this._onFrame; const t = now(); @@ -317,6 +323,7 @@ const Animation = { * @return {Object[]} styles resolved * @private */ + //@interlal _resolveStyles(styles) { if (!styles) { return null; @@ -516,6 +523,7 @@ const Animation = { }, + //@interlal _requestAnimFrame(fn: AnimationCallback) { if (!this._frameQueue) { this._frameQueue = []; @@ -524,12 +532,14 @@ const Animation = { this._a(); }, + //@interlal _a() { if (!this._animationFrameId) { this._animationFrameId = requestAnimFrame(Animation._frameFn); } }, + //@interlal _run() { if (this._frameQueue.length) { const running = this._frameQueue; @@ -561,6 +571,7 @@ const Animation = { return player; }, + //@interlal _frameFn: () => { } }; diff --git a/src/core/Canvas.ts b/src/core/Canvas.ts index 02a0561bf7..423c402bb4 100644 --- a/src/core/Canvas.ts +++ b/src/core/Canvas.ts @@ -17,12 +17,7 @@ import { BBOX_TEMP, resetBBOX, setBBOX } from './util/bbox'; import Extent from '../geo/Extent'; import Size from '../geo/Size'; -export type Ctx = CanvasRenderingContext2D -// export type Ctx = CanvasRenderingContext2D & { -// canvas: HTMLCanvasElement & { -// _drawn: boolean -// } -// } +export type Ctx = CanvasRenderingContext2D; const DEFAULT_STROKE_COLOR = '#000'; const DEFAULT_FILL_COLOR = 'rgba(255,255,255,0)'; @@ -239,6 +234,7 @@ const Canvas = { } }, + //@interlal _createGradient(ctx: Ctx, g, extent: Extent) { let gradient = null, places = g['places']; @@ -283,6 +279,7 @@ const Canvas = { return gradient; }, + //@interlal _setStrokePattern(ctx: Ctx, strokePattern: string, strokeWidth: number, linePatternOffset: number, resources) { const imgUrl = extractImageUrl(strokePattern); let imageTexture; @@ -415,6 +412,7 @@ const Canvas = { return Canvas._textOnMultiRow(ctx, textDesc['rows'], style, pt, textDesc['size'], textDesc['rawSize']); }, + //@interlal _textOnMultiRow(ctx: Ctx, texts: any[], style, point, splitTextSize: Size, textSize: Size) { const ptAlign = getAlignPoint(splitTextSize, style['textHorizontalAlignment'], style['textVerticalAlignment']), lineHeight = textSize['height'] + style['textLineSpacing'], @@ -440,6 +438,7 @@ const Canvas = { return BBOX_TEMP; }, + //@interlal _textOnLine(ctx: Ctx, text, pt, textHaloRadius: number, textHaloFill, textHaloAlpha: number) { if (hitTesting) { textHaloAlpha = 1; @@ -499,6 +498,7 @@ const Canvas = { ctx.fillText(text, pt.x, pt.y + textOffsetY); }, + //@interlal _stroke(ctx, strokeOpacity, x?, y?) { if (hitTesting) { strokeOpacity = 1; @@ -537,6 +537,7 @@ const Canvas = { } }, + //@interlal _path(ctx, points, lineDashArray?, lineOpacity?, ignoreStrokePattern?) { if (!isArrayHasData(points)) { return; @@ -591,6 +592,7 @@ const Canvas = { Canvas._stroke(ctx, lineOpacity); }, + //@interlal _multiClip(ctx, points) { if (!points || points.length === 0) return; points.forEach(pts => { @@ -728,6 +730,7 @@ const Canvas = { } }, + //@interlal _ring(ctx, ring, lineDashArray, lineOpacity, ignorePattern?) { const isPattern = Canvas._isPattern(ctx.strokeStyle); if (!ignorePattern && isPattern && !ring[0].equals(ring[ring.length - 1])) { @@ -914,6 +917,7 @@ const Canvas = { * @param {Point} p2 point 2 * @param {Number} degree arc degree between p1 and p2 */ + //@interlal _arcBetween(ctx: CanvasRenderingContext2D, p1: Point, p2: Point, degree: number) { //degree可能是负角度 const a = Math.abs(degree), @@ -961,9 +965,9 @@ const Canvas = { const x2 = Math.cos(endAngle - aAngle) * r + cx; const y2 = Math.sin(endAngle - aAngle) * r + cy; /** - * + * * P1-arrowNextPoint------------------arrowNextPoint-P2 - * + * */ p1.arrowNextPoint = p1.arrowNextPoint || new Point(0, 0); p2.arrowPrePoint = p2.arrowPrePoint || new Point(0, 0); @@ -981,6 +985,7 @@ const Canvas = { return [cx, cy]; }, + //@interlal _lineTo(ctx: CanvasRenderingContext2D, p) { ctx.lineTo(p.x, p.y); }, @@ -998,6 +1003,7 @@ const Canvas = { Canvas._stroke(ctx, lineOpacity); }, + //@interlal _bezierCurveTo(ctx: CanvasRenderingContext2D, p1, p2, p3) { ctx.bezierCurveTo(p1.x, p1.y, p2.x, p2.y, p3.x, p3.y); }, @@ -1063,6 +1069,7 @@ const Canvas = { sector(ctx, pt.x, pt.y, size, startAngle, endAngle); }, + //@interlal _isPattern(style: any) { return !isString(style) && !('addColorStop' in style); }, diff --git a/src/core/Class.ts b/src/core/Class.ts index 614c5986f3..f19059324f 100644 --- a/src/core/Class.ts +++ b/src/core/Class.ts @@ -41,8 +41,11 @@ export type ClassOptions = Record; * @category core */ class Class { + //@interlal _isUpdatingOptions?: boolean; + //@interlal _initHooksCalled?: boolean; + //@interlal _initHooks?: Function[]; options?: ClassOptions; /** @@ -190,6 +193,7 @@ class Class { } /* eslint-enable @typescript-eslint/no-unused-vars */ + //@interlal _visitInitHooks(proto) { if (this._initHooksCalled) { return; diff --git a/src/core/CollisionIndex.ts b/src/core/CollisionIndex.ts index 0a53705392..22ec83a490 100644 --- a/src/core/CollisionIndex.ts +++ b/src/core/CollisionIndex.ts @@ -20,6 +20,7 @@ const search: Search = { * 2.2 如果没有,如果需要的,insert到collisionIndex中 */ class CollisionIndex { + //@interlal _tree: any constructor() { this._tree = rbush(9, ['[0]', '[1]', '[2]', '[3]']); diff --git a/src/core/Eventable.ts b/src/core/Eventable.ts index 6ec4314ee8..a141509b05 100644 --- a/src/core/Eventable.ts +++ b/src/core/Eventable.ts @@ -34,9 +34,12 @@ export type HandlerFn = (result?: HandlerFnResultType) => void | boolean; export default function (Base: T) { return class EventableMixin extends Base { - _eventMap?: Record; - _eventParent?: EventableMixin; - _eventTarget?: any; + //@interlal + _eventMap?: Record; + //@interlal + _eventParent?: EventableMixin; + //@interlal + _eventTarget?: any; /** * 注册事件的监听 * @@ -307,7 +310,8 @@ export default function (Base: T) { return this._fire.call(this, eventType, param); } - _wrapOnceHandler(evtType: string, handler: HandlerFn, context?: any) { + //@interlal + _wrapOnceHandler(evtType: string, handler: HandlerFn, context?: any) { // const me = this; const key = generateWrapKey(evtType); let called = false; @@ -329,7 +333,8 @@ export default function (Base: T) { return fn; } - _switch(to: string, eventRecords: EventRecords, context?: any) { + //@interlal + _switch(to: string, eventRecords: EventRecords, context?: any) { for (const p in eventRecords) { if (eventRecords.hasOwnProperty(p)) { this[to](p, eventRecords[p], context); @@ -338,7 +343,8 @@ export default function (Base: T) { return this; } - _clearListeners(eventType: string) { + //@interlal + _clearListeners(eventType: string) { if (!this._eventMap || !isString(eventType)) { return; } @@ -349,7 +355,8 @@ export default function (Base: T) { this._eventMap[eventType] = null; } - _clearAllListeners() { + //@interlal + _clearAllListeners() { this._eventMap = null; } @@ -361,17 +368,20 @@ export default function (Base: T) { * @param parent - event parent * @private */ - _setEventParent(parent: EventableMixin) { + //@interlal + _setEventParent(parent: EventableMixin) { this._eventParent = parent; return this; } - _setEventTarget(target) { + //@interlal + _setEventTarget(target) { this._eventTarget = target; return this; } - _fire(eventType: string, param: BaseEventParamsType) { + //@interlal + _fire(eventType: string, param: BaseEventParamsType) { if (!this._eventMap) { return this; } diff --git a/src/core/JSONAble.ts b/src/core/JSONAble.ts index 0cbfdbfd73..84a50b6306 100644 --- a/src/core/JSONAble.ts +++ b/src/core/JSONAble.ts @@ -10,7 +10,8 @@ const registeredTypes:JSONTypes = {}; */ export default function (Base: Class) { return class JSONAble extends Base { - _jsonType?: string + //@interlal + _jsonType?: string /** * 静态方法,用于将该类注册用于JSON序列化与反序列化 * diff --git a/src/core/util/path.ts b/src/core/util/path.ts index 100a16dc96..405b3540a6 100644 --- a/src/core/util/path.ts +++ b/src/core/util/path.ts @@ -45,6 +45,7 @@ export function clipSegment(a, b, bounds, useLastCode, round, noCut) { codeOut, p, newCode; // save 2nd code to avoid calculating it on the next segment + //@interlal _lastCode = codeB; /* eslint-disable no-constant-condition */ while (true) { diff --git a/src/core/util/style.ts b/src/core/util/style.ts index 825439b130..72e31da9c3 100644 --- a/src/core/util/style.ts +++ b/src/core/util/style.ts @@ -78,9 +78,11 @@ export function lowerSymbolOpacity(symbol: Object | Object[], ratio: number): Ob function s(_symbol, _ratio) { const op = _symbol['opacity']; if (isNil(op)) { - _symbol['opacity'] = _ratio; + //@interlal + _symbol['opacity'] = _ratio; } else { - _symbol['opacity'] *= _ratio; + //@interlal + _symbol['opacity'] *= _ratio; } } let lower; diff --git a/src/core/worker/Actor.ts b/src/core/worker/Actor.ts index 155cbb9e02..9fa3578548 100644 --- a/src/core/worker/Actor.ts +++ b/src/core/worker/Actor.ts @@ -58,6 +58,7 @@ const EMPTY_BUFFERS = []; }); */ class Actor { + //@interlal _delayMessages: Message[] initializing: boolean workerKey: string @@ -294,4 +295,4 @@ function checkBrowserMaxFPS() { } } -pushLoopHook(checkBrowserMaxFPS); \ No newline at end of file +pushLoopHook(checkBrowserMaxFPS); diff --git a/src/core/worker/WorkerPool.ts b/src/core/worker/WorkerPool.ts index cfa0ac796c..bb6283e268 100644 --- a/src/core/worker/WorkerPool.ts +++ b/src/core/worker/WorkerPool.ts @@ -8,7 +8,9 @@ const hardwareConcurrency = typeof window !== 'undefined' ? (window.navigator.ha const hardwareWorkerCount = Math.max(Math.floor(hardwareConcurrency / 2), 1); class MessageBatch { + //@interlal _limit: number + //@interlal _messages: Message[] buffers: ArrayBuffer[] constructor(limit = 50) { @@ -49,7 +51,9 @@ export default class WorkerPool { [key: number]: boolean } workerCount: number + //@interlal _messages: MessageBatch[][] + //@interlal _messageBuffers: ArrayBuffer[] workers: Worker[] constructor() { diff --git a/src/geometry/ArcCurve.ts b/src/geometry/ArcCurve.ts index fadcbf919c..b586b7cb97 100644 --- a/src/geometry/ArcCurve.ts +++ b/src/geometry/ArcCurve.ts @@ -35,6 +35,7 @@ const options: ArcCurveOptionsType = { * ).addTo(layer); */ class ArcCurve extends Curve { + //@interlal _toJSON(options: any): any { return { 'feature': this.toGeoJSON(options), @@ -43,6 +44,7 @@ class ArcCurve extends Curve { } // paint method on canvas + //@interlal _paintOn(ctx: CanvasRenderingContext2D, points: Array, lineOpacity: number): void { ctx.beginPath(); this._arc(ctx, points, lineOpacity); diff --git a/src/geometry/CenterMixin.ts b/src/geometry/CenterMixin.ts index 2406dd9cf1..a6338f5f79 100644 --- a/src/geometry/CenterMixin.ts +++ b/src/geometry/CenterMixin.ts @@ -13,14 +13,20 @@ import type { Map } from '../map'; */ export default function (Base: T) { return class extends Base { - public _coordinates: Coordinate - public _pcenter: Coordinate - public _dirtyCoords: boolean + //@interlal + _coordinates: Coordinate + //@interlal + _pcenter: Coordinate + //@interlal + _dirtyCoords: boolean getMap?(): Map - _getProjection?(): CommonProjectionType + //@interlal + _getProjection?(): CommonProjectionType onPositionChanged?(): void - _verifyProjection?(): void - _clearCache?(): void + //@interlal + _verifyProjection?(): void + //@interlal + _clearCache?(): void /** * 获取几何图形的中心点 * @english @@ -56,7 +62,8 @@ export default function (Base: T) { } //Gets view point of the geometry's center - _getCenter2DPoint(res?: number): Point { + //@interlal + _getCenter2DPoint(res?: number): Point { const map = this.getMap(); if (!map) { return null; @@ -69,7 +76,8 @@ export default function (Base: T) { return map._prjToPointAtRes(pcenter, res); } - _getPrjCoordinates(): Coordinate { + //@interlal + _getPrjCoordinates(): Coordinate { const projection = this._getProjection(); this._verifyProjection(); if (!this._pcenter && projection) { @@ -81,13 +89,15 @@ export default function (Base: T) { } //Set center by projected coordinates - _setPrjCoordinates(pcenter: Coordinate): void { + //@interlal + _setPrjCoordinates(pcenter: Coordinate): void { this._pcenter = pcenter; this.onPositionChanged(); } //update cached const iables if geometry is updated. - _updateCache(): void { + //@interlal + _updateCache(): void { this._clearCache(); const projection = this._getProjection(); if (this._pcenter && projection) { @@ -95,13 +105,15 @@ export default function (Base: T) { } } - _clearProjection(): void { + //@interlal + _clearProjection(): void { this._pcenter = null; // @ts-expect-error todo super._clearProjection(); } - _computeCenter(): Coordinate | null { + //@interlal + _computeCenter(): Coordinate | null { return this._coordinates ? this._coordinates.copy() : null; } }; diff --git a/src/geometry/Circle.ts b/src/geometry/Circle.ts index f54de9e023..1fdd2ea68b 100644 --- a/src/geometry/Circle.ts +++ b/src/geometry/Circle.ts @@ -33,7 +33,8 @@ const options: CircleOptionsType = { * @mixes CenterMixin */ export class Circle extends CenterMixin(Polygon) { - public _radius: number + //@interlal + _radius: number static fromJSON(json: Record): Circle { const feature = json['feature']; @@ -118,6 +119,7 @@ export class Circle extends CenterMixin(Polygon) { return this.show(); } + //@interlal _containsPoint(point: Point, tolerance?: number): boolean { const map = this.getMap(); if (map.getPitch()) { @@ -130,6 +132,7 @@ export class Circle extends CenterMixin(Polygon) { return withInEllipse(point, center, se, t); } + //@interlal _computePrjExtent(projection: CommonProjectionType): Extent { const minmax = this._getMinMax(projection); if (!minmax) { @@ -145,6 +148,7 @@ export class Circle extends CenterMixin(Polygon) { return new Extent(pcenter.add(leftx, topy), pcenter.add(rightx, bottomy)); } + //@interlal _computeExtent(measurer: any): Extent { const minmax = this._getMinMax(measurer); if (!minmax) { @@ -153,6 +157,7 @@ export class Circle extends CenterMixin(Polygon) { return new Extent(minmax[0].x, minmax[2].y, minmax[1].x, minmax[3].y, this._getProjection()); } + //@interlal _getMinMax(measurer: any): [Coordinate, Coordinate, Coordinate, Coordinate] { if (!measurer || !this._coordinates || isNil(this._radius)) { return null; @@ -165,6 +170,7 @@ export class Circle extends CenterMixin(Polygon) { return [p1, p2, p3, p4]; } + //@interlal _computeGeodesicLength(): number { if (isNil(this._radius)) { return 0; @@ -172,6 +178,7 @@ export class Circle extends CenterMixin(Polygon) { return Math.PI * 2 * this._radius; } + //@interlal _computeGeodesicArea(): number { if (isNil(this._radius)) { return 0; @@ -179,6 +186,7 @@ export class Circle extends CenterMixin(Polygon) { return Math.PI * Math.pow(this._radius, 2); } + //@interlal _exportGeoJSONGeometry() { const coordinates = Coordinate.toNumberArrays([this.getShell()]); return { @@ -187,6 +195,7 @@ export class Circle extends CenterMixin(Polygon) { }; } + //@interlal _toJSON(options: any) { const center = this.getCenter(); const opts = extend({}, options); diff --git a/src/geometry/ConnectorLine.ts b/src/geometry/ConnectorLine.ts index a409716e56..b9e9ce8a02 100644 --- a/src/geometry/ConnectorLine.ts +++ b/src/geometry/ConnectorLine.ts @@ -18,8 +18,10 @@ const Connectable = function (Base: T) { return class extends Base { options: ConnectableOptionsType; - _connSource: Geometry; - _connTarget: Geometry; + //@interlal + _connSource: Geometry; + //@interlal + _connTarget: Geometry; getMap?(): Map; getCoordinates?(): Coordinate[]; setCoordinates?(coordinates: Coordinate[]): this; @@ -96,7 +98,8 @@ const Connectable = function (Base: T) { return this; } - _updateCoordinates() { + //@interlal + _updateCoordinates() { let map = this.getMap(); if (!map && this._connSource) { map = this._connSource.getMap(); @@ -169,7 +172,8 @@ const Connectable = function (Base: T) { } } - _showConnect(): void { + //@interlal + _showConnect(): void { if (!this._connSource || !this._connTarget) { return; } @@ -179,7 +183,8 @@ const Connectable = function (Base: T) { } } - _registerEvents(): void { + //@interlal + _registerEvents(): void { if (!this._connSource || !this._connTarget) { return; } diff --git a/src/geometry/CubicBezierCurve.ts b/src/geometry/CubicBezierCurve.ts index ecf7ff970d..9614f920de 100644 --- a/src/geometry/CubicBezierCurve.ts +++ b/src/geometry/CubicBezierCurve.ts @@ -31,6 +31,7 @@ class CubicBezierCurve extends Curve { return curve; } + //@interlal _toJSON(options: any): any { return { 'feature': this.toGeoJSON(options), @@ -39,6 +40,7 @@ class CubicBezierCurve extends Curve { } // paint method on canvas + //@interlal _paintOn(ctx: CanvasRenderingContext2D, points: any, lineOpacity: number): void { ctx.beginPath(); ctx.moveTo(points[0].x, points[0].y); @@ -47,6 +49,7 @@ class CubicBezierCurve extends Curve { this._paintArrow(ctx, points, lineOpacity); } + //@interlal _getArrowPoints(arrows: any[], segments: [], lineWidth: number, arrowStyle: any, tolerance: any): any { return this._getCurveArrowPoints(arrows, segments, lineWidth, arrowStyle, tolerance, 3); } diff --git a/src/geometry/Curve.ts b/src/geometry/Curve.ts index 19d43aac26..1c07cf9203 100644 --- a/src/geometry/Curve.ts +++ b/src/geometry/Curve.ts @@ -20,6 +20,7 @@ const options: CurveOptionsType = { * @property {Boolean} [options.enableClip=false] - whether to clip curve with map's current extent */ class Curve extends LineString { + //@interlal _arc(ctx: CanvasRenderingContext2D, points: Array, lineOpacity: number): void { let arcDegree = this.options['arcDegree']; if (arcDegree === 0) { @@ -37,6 +38,7 @@ class Curve extends LineString { } } + //@interlal _quadraticCurve(ctx: CanvasRenderingContext2D, points: any): void { if (points.length <= 2) { Canvas2d._path(ctx, points); @@ -54,6 +56,7 @@ class Curve extends LineString { } } + //@interlal _bezierCurve(ctx: CanvasRenderingContext2D, points: any): void { if (points.length <= 3) { Canvas2d._path(ctx, points); @@ -70,6 +73,7 @@ class Curve extends LineString { } } + //@interlal _getCurveArrowPoints(arrows: any[], segments: [], lineWidth: number, arrowStyle: any, tolerance: any, step: number): void { const l = segments.length; let i: number; diff --git a/src/geometry/Ellipse.ts b/src/geometry/Ellipse.ts index 74fae3d67a..aa43f436d4 100644 --- a/src/geometry/Ellipse.ts +++ b/src/geometry/Ellipse.ts @@ -60,8 +60,8 @@ const options: EllipseOptionsType = { * }); */ export class Ellipse extends CenterMixin(Polygon) { - public width: number - public height: number + width: number + height: number options: EllipseOptionsType; static fromJSON(json: Record): Ellipse { @@ -145,6 +145,7 @@ export class Ellipse extends CenterMixin(Polygon) { return this._getShell(); } + //@interlal _getShell(): RingCoordinates { const measurer = this._getMeasurer(), center = this.getCoordinates(), @@ -200,6 +201,7 @@ export class Ellipse extends CenterMixin(Polygon) { return shell; } + //@interlal _getPrjShell(): RingCoordinates { const shell = super._getPrjShell(); return this._rotatePrjCoordinates(shell) as RingCoordinates; @@ -219,6 +221,7 @@ export class Ellipse extends CenterMixin(Polygon) { return this.show(); } + //@interlal _containsPoint(point: Point, tolerance?: number): boolean { const map = this.getMap(); if (map.isTransforming()) { @@ -232,6 +235,7 @@ export class Ellipse extends CenterMixin(Polygon) { return withInEllipse(point, p0, p1, t); } + //@interlal _computePrjExtent(): Extent { if (this.isRotated()) { return this._computeRotatedPrjExtent(); @@ -240,11 +244,13 @@ export class Ellipse extends CenterMixin(Polygon) { return Circle.prototype._computePrjExtent.apply(this, arguments); } + //@interlal _computeExtent(): any { // eslint-disable-next-line prefer-rest-params return Circle.prototype._computeExtent.apply(this, arguments); } + //@interlal _getMinMax(measurer: any): [Coordinate, Coordinate, Coordinate, Coordinate] { if (!measurer || !this._coordinates || isNil(this.width) || isNil(this.height)) { return null; @@ -258,6 +264,7 @@ export class Ellipse extends CenterMixin(Polygon) { return [p1, p2, p3, p4]; } + //@interlal _computeGeodesicLength(): number { if (isNil(this.width) || isNil(this.height)) { return 0; @@ -268,6 +275,7 @@ export class Ellipse extends CenterMixin(Polygon) { return 2 * Math.PI * longer / 2 - 4 * Math.abs(this.width - this.height); } + //@interlal _computeGeodesicArea(): number { if (isNil(this.width) || isNil(this.height)) { return 0; @@ -275,6 +283,7 @@ export class Ellipse extends CenterMixin(Polygon) { return Math.PI * this.width * this.height / 4; } + //@interlal _exportGeoJSONGeometry() { const coordinates = Coordinate.toNumberArrays([this.getShell()]); return { @@ -283,6 +292,7 @@ export class Ellipse extends CenterMixin(Polygon) { }; } + //@interlal _toJSON(options: any) { const opts = extend({}, options); const center = this.getCenter(); diff --git a/src/geometry/GeoJSON.ts b/src/geometry/GeoJSON.ts index 058d637382..852c18863f 100644 --- a/src/geometry/GeoJSON.ts +++ b/src/geometry/GeoJSON.ts @@ -98,6 +98,7 @@ class GeoJSONFetchActor extends Actor { super(WORKER_KEY); } + //@interlal _sendMsg(options: any, featuresList: any, cb: any) { this.send(options, [], (error?: any, data?: any) => { if (error) { @@ -108,6 +109,7 @@ class GeoJSONFetchActor extends Actor { }, options.workerId); } + //@interlal _fetchGeoJSON(url: any, options: any, featuresList: [] = [], cb: any): void { const opts = extend({}, options); opts.type = 'fetchdata'; @@ -115,6 +117,7 @@ class GeoJSONFetchActor extends Actor { this._sendMsg(opts, featuresList, cb); } + //@interlal _pageFeatures(options: any, features: any, featuresList: any, cb: any): void { featuresList.push(features); if (features.length === 0) { @@ -265,6 +268,7 @@ const GeoJSON = { * @return {Geometry} * @private */ + //@interlal _convert: function (json: any, foreachFn?: any): any { if (!json || isNil(json['type'])) { return null; @@ -326,6 +330,7 @@ const GeoJSON = { return null; }, + //@interlal _isGeoJSON(json: any): boolean { if (!json) { return false; diff --git a/src/geometry/Geometry.ts b/src/geometry/Geometry.ts index 2a26a64694..8a7ce3ec4b 100644 --- a/src/geometry/Geometry.ts +++ b/src/geometry/Geometry.ts @@ -92,61 +92,103 @@ const options: GeometryOptionsType = { */ export class Geometry extends JSONAble(Eventable(Handlerable(Class))) { options: GeometryOptionsType; - public type: string; - public _layer: OverlayLayer; - public _angle: number - public _pivot: Coordinate - public _id: string - public properties: Record; - public _symbol: any - public _symbolUpdated: any - public _compiledSymbol: any - public _symbolHash: any - public _textDesc: any - public _eventSymbolProperties: any - public _sizeSymbol: any - public _internalId: number - public _extent: Extent - public _fixedExtent: PointExtent - public _extent2d: PointExtent - public _externSymbol: any - public _parent: Geometry | GeometryCollection - public _silence: boolean - public _projCode: string - public _painter: Painter - public _maskPainter: CollectionPainter | Painter - public _dirtyCoords: boolean; - public _pcenter: Coordinate - public _coordinates: any; - public _infoWinOptions: InfoWindowOptionsType; - public _minAlt: number - public _maxAlt: number; + type: string; + //@interlal + _layer: OverlayLayer; + //@interlal + _angle: number + //@interlal + _pivot: Coordinate + //@interlal + _id: string + properties: Record; + //@interlal + _symbol: any + //@interlal + _symbolUpdated: any + //@interlal + _compiledSymbol: any + //@interlal + _symbolHash: any + //@interlal + _textDesc: any + //@interlal + _eventSymbolProperties: any + //@interlal + _sizeSymbol: any + //@interlal + _internalId: number + //@interlal + _extent: Extent + //@interlal + _fixedExtent: PointExtent + //@interlal + _extent2d: PointExtent + //@interlal + _externSymbol: any + //@interlal + _parent: Geometry | GeometryCollection + //@interlal + _silence: boolean + //@interlal + _projCode: string + //@interlal + _painter: Painter + //@interlal + _maskPainter: CollectionPainter | Painter + //@interlal + _dirtyCoords: boolean; + //@interlal + _pcenter: Coordinate + //@interlal + _coordinates: any; + //@interlal + _infoWinOptions: InfoWindowOptionsType; + //@interlal + _minAlt: number + //@interlal + _maxAlt: number; // 在 VectorLayerCanvasRenderer 附加的信息 - public _isCheck?: boolean; - public _cPoint?: any; - public _inCurrentView?: boolean; + //@interlal + _isCheck?: boolean; + //@interlal + _cPoint?: any; + //@interlal + _inCurrentView?: boolean; // 在 Marker 中附加的信息,Marker 和其子类都具有此属性 - public isPoint?: boolean; - private _savedVisible?: boolean; + isPoint?: boolean; + //@interlal + _savedVisible?: boolean; // - public _paintAsPath?: () => any; - public _getPaintParams?: (disableSimplify?: boolean) => any[]; - public _simplified?: boolean; - private _dirtyRotate?: boolean; + //@interlal + _paintAsPath?: () => any; + //@interlal + _getPaintParams?: (disableSimplify?: boolean) => any[]; + //@interlal + _simplified?: boolean; + //@interlal + _dirtyRotate?: boolean; // 本身应该存于 Path 类,但是由于渲染层需要大量的特殊熟悉判断,定义在这里回减少很多麻烦 - public getHoles?(): Array>; + getHoles?(): Array>; + //@interlal __connectors: Array; getShell?(): Array; getGeometries?(): Geometry[]; getCoordinates?(): Coordinate | Array | Array> | Array>> setCoordinates?(coordinate: any): this; + //@interlal _computeCenter?(T: any): Coordinate; + //@interlal _computeExtent?(T: any): Extent; onRemove?(): void; + //@interlal _computeGeodesicLength?(T: any): number; + //@interlal _computeGeodesicArea?(T: any): number; getRotateOffsetAngle?(): number; + //@interlal _computePrjExtent?(T: null | ProjectionType): Extent; + //@interlal _updateCache?(): void; onAdd?(): void; @@ -585,6 +627,7 @@ export class Geometry extends JSONAble(Eventable(Handlerable(Class))) { return extent; } + //@interlal _getFixedExtent(): PointExtent { // only for LineString and Polygon, Marker's will be overrided if (!this._fixedExtent) { @@ -659,6 +702,7 @@ export class Geometry extends JSONAble(Eventable(Handlerable(Class))) { // return this._containsPoint(this.getMap()._containerPointToPoint(new Point(containerPoint)), t); } + //@interlal _containsPoint(containerPoint: Point, t?: number): boolean { const painter = this._getPainter(); if (!painter) { @@ -1180,6 +1224,7 @@ export class Geometry extends JSONAble(Eventable(Handlerable(Class))) { return this; } + //@interlal _rotatePrjCoordinates(coordinates: Coordinate | Array): Coordinate | Coordinate[] { if (!coordinates || this._angle === 0 || !this._pivot) { return coordinates; @@ -1246,11 +1291,13 @@ export class Geometry extends JSONAble(Eventable(Handlerable(Class))) { * @return {Coordinate[]} connect points * @private */ + //@interlal _getConnectPoints(): Coordinate[] { return [this.getCenter()]; } //options initializing + //@interlal _initOptions(options: GeometryOptionsType): void { const opts = extend({}, options); const symbol = opts['symbol']; @@ -1272,6 +1319,7 @@ export class Geometry extends JSONAble(Eventable(Handlerable(Class))) { } //bind the geometry to a layer + //@interlal _bindLayer(layer: OverlayLayer): void { if (layer === this.getLayer()) { return; @@ -1288,6 +1336,7 @@ export class Geometry extends JSONAble(Eventable(Handlerable(Class))) { // this.callInitHooks(); } + //@interlal _prepareSymbol(symbol: any): any { if (Array.isArray(symbol)) { const cookedSymbols = []; @@ -1302,6 +1351,7 @@ export class Geometry extends JSONAble(Eventable(Handlerable(Class))) { return null; } + //@interlal _checkAndCopySymbol(symbol: any): any { const s = {}; for (const i in symbol) { @@ -1314,6 +1364,7 @@ export class Geometry extends JSONAble(Eventable(Handlerable(Class))) { return s; } + //@interlal _getSymbol(): any { return this._symbol; } @@ -1325,6 +1376,7 @@ export class Geometry extends JSONAble(Eventable(Handlerable(Class))) { * @private * @param {Object} symbol - external symbol */ + //@interlal _setExternSymbol(symbol: any): this { this._eventSymbolProperties = symbol; if (!this._symbol) { @@ -1335,6 +1387,7 @@ export class Geometry extends JSONAble(Eventable(Handlerable(Class))) { return this; } + //@interlal _getInternalSymbol(): any { if (this._symbol) { return this._symbol; @@ -1346,6 +1399,7 @@ export class Geometry extends JSONAble(Eventable(Handlerable(Class))) { return null; } + //@interlal _getPrjExtent(): Extent { const p = this._getProjection(); this._verifyProjection(); @@ -1355,6 +1409,7 @@ export class Geometry extends JSONAble(Eventable(Handlerable(Class))) { return this._extent; } + //@interlal _unbind(): void { const layer = this.getLayer(); if (!layer) { @@ -1385,15 +1440,18 @@ export class Geometry extends JSONAble(Eventable(Handlerable(Class))) { delete this._extent; } + //@interlal _getInternalId(): number { return this._internalId; } //只能被图层调用 + //@interlal _setInternalId(id: number): void { this._internalId = id; } + //@interlal _getMeasurer(): any { if (this._getProjection()) { return this._getProjection(); @@ -1401,6 +1459,7 @@ export class Geometry extends JSONAble(Eventable(Handlerable(Class))) { return SpatialReference.getProjectionInstance(this.options['defaultProjection']); } + //@interlal _getProjection(): WithNull { const map = this.getMap(); if (map) { @@ -1409,6 +1468,7 @@ export class Geometry extends JSONAble(Eventable(Handlerable(Class))) { return null; } + //@interlal _verifyProjection(): void { const projection = this._getProjection(); if (this._projCode && projection && this._projCode !== projection.code) { @@ -1418,11 +1478,13 @@ export class Geometry extends JSONAble(Eventable(Handlerable(Class))) { } //获取geometry样式中依赖的外部图片资源 + //@interlal _getExternalResources(): string[] { const symbol = this._getInternalSymbol(); return getExternalResources(symbol); } + //@interlal _getPainter(): any { //for performance if (this._painter) { @@ -1451,6 +1513,7 @@ export class Geometry extends JSONAble(Eventable(Handlerable(Class))) { return this._painter; } + //@interlal _getMaskPainter(): CollectionPainter | Painter { if (this._maskPainter) { return this._maskPainter; @@ -1459,6 +1522,7 @@ export class Geometry extends JSONAble(Eventable(Handlerable(Class))) { return this._maskPainter; } + //@interlal _removePainter(): void { if (this._painter) { this._painter.remove(); @@ -1466,6 +1530,7 @@ export class Geometry extends JSONAble(Eventable(Handlerable(Class))) { delete this._painter; } + //@interlal _paint(extent?: Extent): void { if (!this.symbolIsVisible()) { return; @@ -1487,17 +1552,20 @@ export class Geometry extends JSONAble(Eventable(Handlerable(Class))) { } } + //@interlal _clearCache(): void { delete this._extent; delete this._extent2d; this._clearAltitudeCache(); } + //@interlal _clearProjection(): void { delete this._extent; delete this._extent2d; } + //@interlal _repaint(): void { if (this._painter) { this._painter.repaint(); @@ -1562,6 +1630,7 @@ export class Geometry extends JSONAble(Eventable(Handlerable(Class))) { this._fireEvent('symbolchange', e); } + //@interlal _genSizeSymbol(): void { const symbol = this._getInternalSymbol(); if (!symbol) { @@ -1583,6 +1652,7 @@ export class Geometry extends JSONAble(Eventable(Handlerable(Class))) { } } + //@interlal _getSizeSymbol(symbol: any): any { const symbolSize = loadGeoSymbol({ lineWidth: symbol['lineWidth'], @@ -1595,6 +1665,7 @@ export class Geometry extends JSONAble(Eventable(Handlerable(Class))) { return symbolSize; } + //@interlal _getCompiledSymbol(): any { if (this._compiledSymbol) { return this._compiledSymbol; @@ -1634,16 +1705,19 @@ export class Geometry extends JSONAble(Eventable(Handlerable(Class))) { * @param {GeometryCollection} geometry - parent geometry * @private */ + //@interlal _setParent(geometry?: Geometry | GeometryCollection): void { if (geometry) { this._parent = geometry; } } + //@interlal _getParent(): any { return this._parent; } + //@interlal _fireEvent(eventName: string, param?: BaseEventParamsType) { if (this._silence) { return; @@ -1659,12 +1733,14 @@ export class Geometry extends JSONAble(Eventable(Handlerable(Class))) { this.fire(eventName, param); } + //@interlal _toJSON(options?: any): any { return { 'feature': this.toGeoJSON(options) }; } + //@interlal _recordVisible() { let visible = this.options.visible; if (isNil(visible)) { @@ -1674,10 +1750,12 @@ export class Geometry extends JSONAble(Eventable(Handlerable(Class))) { } + //@interlal _recoveryVisible() { delete this._savedVisible; } + //@interlal _exportGraphicOptions(options: any): any { const json = {}; if (isNil(options['options']) || options['options']) { @@ -1697,6 +1775,7 @@ export class Geometry extends JSONAble(Eventable(Handlerable(Class))) { return json; } + //@interlal _exportGeoJSONGeometry(): any { const points: any = this.getCoordinates(); const coordinates = Coordinate.toNumberArrays(points); @@ -1706,6 +1785,7 @@ export class Geometry extends JSONAble(Eventable(Handlerable(Class))) { }; } + //@interlal _exportProperties(): any { let properties = null; const geoProperties = this.getProperties(); @@ -1719,6 +1799,7 @@ export class Geometry extends JSONAble(Eventable(Handlerable(Class))) { return properties; } + //@interlal _hitTestTolerance(): number { return 0; } @@ -1727,6 +1808,7 @@ export class Geometry extends JSONAble(Eventable(Handlerable(Class))) { //------------- altitude + layer.altitude ------------- //this is for vectorlayer //内部方法 for render,返回的值受layer和layer.options.enableAltitude,layer.options.altitude影响 + //@interlal _getAltitude(): number | number[] | number[][] { const layer = this.getLayer(); if (!layer) { @@ -1818,6 +1900,7 @@ export class Geometry extends JSONAble(Eventable(Handlerable(Class))) { return this; } + //@interlal _genMinMaxAlt(): void { if (this._minAlt === undefined || this._maxAlt === undefined) { const altitude = this._getAltitude(); @@ -1838,6 +1921,7 @@ export class Geometry extends JSONAble(Eventable(Handlerable(Class))) { } //clear alt cache + //@interlal _clearAltitudeCache(): Geometry { this._minAlt = undefined; this._maxAlt = undefined; diff --git a/src/geometry/GeometryCollection.ts b/src/geometry/GeometryCollection.ts index 441d79e757..bab7c1447b 100644 --- a/src/geometry/GeometryCollection.ts +++ b/src/geometry/GeometryCollection.ts @@ -29,11 +29,16 @@ const TEMP_EXTENT = new PointExtent(); */ class GeometryCollection extends Geometry { - public _geometries: Geometry[] - public _pickGeometryIndex: number - public _originalSymbol: any - public _draggbleBeforeEdit: any - public _editing: boolean + //@interlal + _geometries: Geometry[] + //@interlal + _pickGeometryIndex: number + //@interlal + _originalSymbol: any + //@interlal + _draggbleBeforeEdit: any + //@interlal + _editing: boolean /** * @param {Geometry[]} geometries - GeometryCollection's geometries @@ -277,6 +282,7 @@ class GeometryCollection extends Geometry { return this; } + //@interlal _setExternSymbol(symbol: any): this { symbol = this._prepareSymbol(symbol); this._externSymbol = symbol; @@ -294,12 +300,14 @@ class GeometryCollection extends Geometry { * @param {Layer} layer * @private */ + //@interlal _bindLayer(): void { // eslint-disable-next-line prefer-rest-params super._bindLayer.apply(this, arguments); this._bindGeometriesToLayer(); } + //@interlal _bindGeometriesToLayer() { const layer = this.getLayer(); this.forEach(function (geometry) { @@ -314,6 +322,7 @@ class GeometryCollection extends Geometry { * @param {Geometry[]} geometries - geometries to check * @private */ + //@interlal _checkGeometries(geometries: Geometry[]): Geometry[] { const invalidGeoError = 'The geometry added to collection is invalid.'; geometries = Array.isArray(geometries) ? geometries : [geometries]; @@ -338,10 +347,12 @@ class GeometryCollection extends Geometry { return filterGeometries; } + //@interlal _checkGeo(geo: Geometry): boolean { return (geo instanceof Geometry); } + //@interlal _updateCache(): void { this._clearCache(); if (this.isEmpty()) { @@ -354,6 +365,7 @@ class GeometryCollection extends Geometry { }); } + //@interlal _removePainter(): void { if (this._painter) { this._painter.remove(); @@ -364,6 +376,7 @@ class GeometryCollection extends Geometry { }); } + //@interlal _computeCenter(projection: null | ProjectionCommon): Coordinate { if (!projection || this.isEmpty()) { return null; @@ -389,6 +402,7 @@ class GeometryCollection extends Geometry { return new Coordinate(sumX / counter, sumY / counter); } + //@interlal _containsPoint(point: Point, t?: number): boolean { if (this.isEmpty()) { return false; @@ -405,6 +419,7 @@ class GeometryCollection extends Geometry { } // fix #2177 GeometryCollection hitTolerance always is 0 + //@interlal _hitTestTolerance(): number { const geometries = this.getGeometries(); let hitTolerance = 0; @@ -415,14 +430,17 @@ class GeometryCollection extends Geometry { return hitTolerance; } + //@interlal _computeExtent(projection: null | ProjectionCommon): Extent { return computeExtent.call(this, projection, '_computeExtent'); } + //@interlal _computePrjExtent(projection: null | ProjectionCommon): Extent { return computeExtent.call(this, projection, '_computePrjExtent'); } + //@interlal _computeGeodesicLength(projection: null | ProjectionCommon): number { if (!projection || this.isEmpty()) { return 0; @@ -438,6 +456,7 @@ class GeometryCollection extends Geometry { return result; } + //@interlal _computeGeodesicArea(projection: null | ProjectionCommon): number { if (!projection || this.isEmpty()) { return 0; @@ -454,6 +473,7 @@ class GeometryCollection extends Geometry { } //for toGeoJSON + //@interlal _exportGeoJSONGeometry() { const children = []; if (!this.isEmpty()) { @@ -471,6 +491,7 @@ class GeometryCollection extends Geometry { }; } //for toJSON + //@interlal _toJSON(options?: any) { //fix call from feature-filter package options = extend({}, options); @@ -503,6 +524,7 @@ class GeometryCollection extends Geometry { return options; } + //@interlal _clearProjection() { if (this.isEmpty()) { return; @@ -524,6 +546,7 @@ class GeometryCollection extends Geometry { * @private * @return {Coordinate[]} */ + //@interlal _getConnectPoints(): Coordinate[] { const extent = this.getExtent(); const anchors = [ @@ -535,6 +558,7 @@ class GeometryCollection extends Geometry { return anchors; } + //@interlal _getExternalResources(): any { if (this.isEmpty()) { return []; diff --git a/src/geometry/Label.ts b/src/geometry/Label.ts index 8cac76f829..e801ff0ac8 100644 --- a/src/geometry/Label.ts +++ b/src/geometry/Label.ts @@ -68,7 +68,7 @@ const options: LabelOptionsType = { */ class Label extends TextMarker { - public options: any + options: any /** * @param {String} content - Label's text content @@ -146,10 +146,12 @@ class Label extends TextMarker { return label; } + //@interlal _canEdit(): boolean { return false; } + //@interlal _toJSON(options: any) { return { 'feature': this.toGeoJSON(options), @@ -158,6 +160,7 @@ class Label extends TextMarker { }; } + //@interlal _refresh(): void { const symbol = extend({}, this.getTextSymbol(), @@ -206,6 +209,7 @@ class Label extends TextMarker { delete this._refreshing; } + //@interlal _getBoxSize(symbol: any): any { if (!symbol['markerType']) { symbol['markerType'] = 'square'; diff --git a/src/geometry/LineString.ts b/src/geometry/LineString.ts index dbb65e0cc2..721bb4736f 100644 --- a/src/geometry/LineString.ts +++ b/src/geometry/LineString.ts @@ -98,10 +98,12 @@ export class LineString extends Path { return this._getCenterInExtent(extent, this.getCoordinates(), clipLine); } + //@interlal _computeGeodesicLength(measurer: any): number { return measurer.measureLength(this.getCoordinates()); } + //@interlal _computeGeodesicArea(): number { return 0; } diff --git a/src/geometry/Marker.ts b/src/geometry/Marker.ts index 0f77a8179f..5d79aef750 100644 --- a/src/geometry/Marker.ts +++ b/src/geometry/Marker.ts @@ -54,7 +54,7 @@ const options: MarkerOptionsType = { * }); */ export class Marker extends CenterMixin(Geometry) { - public isPoint: boolean + isPoint: boolean /** * @param {Coordinate} coordinates - coordinates of the marker * @param {Object} [options=null] - construct options defined in [Marker]{@link Marker#options} @@ -92,6 +92,7 @@ export class Marker extends CenterMixin(Geometry) { return super.setSymbol.call(this, symbol); } + //@interlal _getSizeSymbol(symbol: any): any { const s = {}; let dynamic = false; @@ -129,6 +130,7 @@ export class Marker extends CenterMixin(Geometry) { return sizeSymbol; } + //@interlal _setExternSymbol(symbol: any) { if (!this._symbol) { delete this._fixedExtent; @@ -136,10 +138,12 @@ export class Marker extends CenterMixin(Geometry) { return super._setExternSymbol(symbol); } + //@interlal _isDynamicSize(): boolean { return this._sizeSymbol && this._sizeSymbol._dynamic; } + //@interlal _getFixedExtent(): PointExtent { if (this._fixedExtent && !this._isDynamicSize()) { return this._fixedExtent; @@ -167,6 +171,7 @@ export class Marker extends CenterMixin(Geometry) { return this._fixedExtent; } + //@interlal _isVectorMarker(): boolean { const symbol = this._getInternalSymbol(); if (Array.isArray(symbol)) { @@ -182,6 +187,7 @@ export class Marker extends CenterMixin(Geometry) { * @return {Boolean} * @private */ + //@interlal _canEdit(): boolean { const symbol = this._getInternalSymbol(); if (Array.isArray(symbol)) { @@ -190,6 +196,7 @@ export class Marker extends CenterMixin(Geometry) { return isVectorSymbol(symbol) || isPathSymbol(symbol) || isImageSymbol(symbol); } + //@interlal _containsPoint(point: Point, t?: number): boolean { let extent = this.getContainerExtent(); if (t) { @@ -206,22 +213,27 @@ export class Marker extends CenterMixin(Geometry) { } } + //@interlal _computeExtent(): Extent { return computeExtent.call(this, 'getCenter'); } + //@interlal _computePrjExtent(): Extent { return computeExtent.call(this, '_getPrjCoordinates'); } + //@interlal _computeGeodesicLength(): number { return 0; } + //@interlal _computeGeodesicArea(): number { return 0; } + //@interlal _getSprite(resources: any, canvasClass: any) { if (this._getPainter()) { return this._getPainter().getSprite(resources, canvasClass); diff --git a/src/geometry/MultiGeometry.ts b/src/geometry/MultiGeometry.ts index 2644eaf71a..437b9ba8ef 100644 --- a/src/geometry/MultiGeometry.ts +++ b/src/geometry/MultiGeometry.ts @@ -24,7 +24,7 @@ type GeometryClass = (new (coordinates: SingleGeometryCreateCoordinates, opti class MultiGeometry extends GeometryCollection { - public GeometryType: GeometryClass; + GeometryType: GeometryClass; /** * @param {Class} geoType Type of the geometry @@ -74,6 +74,7 @@ class MultiGeometry extends GeometryCollection { return this; } + //@interlal _initData(data: MultiGeometryData): void { data = data || []; if (data.length) { @@ -85,12 +86,14 @@ class MultiGeometry extends GeometryCollection { } } + //@interlal _checkGeo(geo: Geometry): boolean { return (geo instanceof this.GeometryType); } //override _exportGeoJSONGeometry in GeometryCollection // @ts-expect-error 确实需要重写父类的属性 + //@interlal _exportGeoJSONGeometry() { const points = this.getCoordinates(); const coordinates = Coordinate.toNumberArrays(points as MultiPathsCoordinates); @@ -100,6 +103,7 @@ class MultiGeometry extends GeometryCollection { }; } + //@interlal _toJSON(options: any) { return { 'feature': this.toGeoJSON(options) diff --git a/src/geometry/Path.ts b/src/geometry/Path.ts index d3babf4f5d..3b2a45a1dd 100644 --- a/src/geometry/Path.ts +++ b/src/geometry/Path.ts @@ -50,18 +50,30 @@ export type MultiPathsCoordinates = Array; */ export class Path extends Geometry { + //@interlal _coordinates: Coordinate[]; - public _showPlayer: Player; - public _animIdx: number - public _animLenSoFar: number - public _animTailRatio: number - public _prjAniShowCenter: Coordinate - public _aniShowCenter: Coordinate - public _tempCoord: Coordinate - public _tempPrjCoord: Point - public _simplified: boolean - public _prjCoords: Array + //@interlal + _showPlayer: Player; + //@interlal + _animIdx: number + //@interlal + _animLenSoFar: number + //@interlal + _animTailRatio: number + //@interlal + _prjAniShowCenter: Coordinate + //@interlal + _aniShowCenter: Coordinate + //@interlal + _tempCoord: Coordinate + //@interlal + _tempPrjCoord: Point + //@interlal + _simplified: boolean + //@interlal + _prjCoords: Array hasHoles?(): boolean; + //@interlal _getPrjHoles?(): Array>; /** @@ -162,6 +174,7 @@ export class Path extends Geometry { return player; } + //@interlal _drawAnimShowFrame(t: number, duration: number, length: number, coordinates: Coordinate[], prjCoords: Array): Coordinate { if (t === 0) { return coordinates[0]; @@ -233,6 +246,7 @@ export class Path extends Geometry { return targetCoord; } + //@interlal _getCenterInExtent(extent: Extent, coordinates: Coordinate[], clipFn: any): Coordinate { const meExtent = this.getExtent(); if (!extent.intersects(meExtent)) { @@ -278,6 +292,7 @@ export class Path extends Geometry { * @returns {Point[]} * @private */ + //@interlal _getPath2DPoints(prjCoords: PathCoordinates | PathsCoordinates, disableSimplify: boolean, res?: number): Point | Array | Array> { if (!isArrayHasData(prjCoords)) { return []; @@ -316,17 +331,20 @@ export class Path extends Geometry { // return forEachCoord(prjCoords, c => map._prjToPoint(c, zoom)); } + //@interlal _shouldSimplify(): boolean { const layer = this.getLayer(); const hasAltitude = layer.options['enableAltitude']; return layer && layer.options['enableSimplify'] && !hasAltitude && this.options['enableSimplify'] && !this._showPlayer/* && !this.options['smoothness'] */; } + //@interlal _setPrjCoordinates(prjPoints: PathCoordinates): void { this._prjCoords = prjPoints; this.onShapeChanged(); } + //@interlal _getPrjCoordinates(): PathCoordinates { this._verifyProjection(); if (!this._prjCoords && this._getProjection()) { @@ -336,6 +354,7 @@ export class Path extends Geometry { } //update cached variables if geometry is updated. + //@interlal _updateCache(): void { this._clearCache(); const projection = this._getProjection(); @@ -347,11 +366,13 @@ export class Path extends Geometry { } } + //@interlal _clearProjection(): void { this._prjCoords = null; super._clearProjection(); } + //@interlal _projectCoords(points: PathCoordinates | PathsCoordinates): PathCoordinates | PathsCoordinates { const projection = this._getProjection(); if (projection) { @@ -360,6 +381,7 @@ export class Path extends Geometry { return []; } + //@interlal _unprojectCoords(prjPoints: PathCoordinates | PathsCoordinates): PathCoordinates | PathsCoordinates { const projection = this._getProjection(); if (projection) { @@ -368,6 +390,7 @@ export class Path extends Geometry { return []; } + //@interlal _computeCenter(): null | Coordinate { const ring = this._coordinates; if (!isArrayHasData(ring)) { @@ -389,6 +412,7 @@ export class Path extends Geometry { return new Coordinate(sumx / counter, sumy / counter); } + //@interlal _computeExtent(_?: any): Extent { const shell = this._coordinates; if (!isArrayHasData(shell)) { @@ -401,6 +425,7 @@ export class Path extends Geometry { return this._coords2Extent(rings, this._getProjection()); } + //@interlal _computePrjExtent(_?: any): Extent { const coords = [this._getPrjCoordinates()]; if (this.hasHoles && this.hasHoles()) { @@ -409,6 +434,7 @@ export class Path extends Geometry { return this._coords2Extent(coords); } + //@interlal _get2DLength(): number { const vertexes = this._getPath2DPoints(this._getPrjCoordinates(), true) as Point[]; let len = 0; @@ -418,6 +444,7 @@ export class Path extends Geometry { return len; } + //@interlal _hitTestTolerance(): number { const symbol = this._getInternalSymbol(); let w; @@ -436,6 +463,7 @@ export class Path extends Geometry { return super._hitTestTolerance() + (isNumber(w) ? w / 2 : 1.5); } + //@interlal _coords2Extent(coords: PathsCoordinates, proj?: CommonProjectionType): Extent { // linestring, polygon if (!coords || coords.length === 0 || (Array.isArray(coords[0]) && coords[0].length === 0)) { diff --git a/src/geometry/Polygon.ts b/src/geometry/Polygon.ts index 09eeed3fec..f9bb4fb576 100644 --- a/src/geometry/Polygon.ts +++ b/src/geometry/Polygon.ts @@ -35,9 +35,13 @@ export type RingsCoordinates = PathsCoordinates; export class Polygon extends Path { - public _holes: RingsCoordinates; - public _prjHoles: RingsCoordinates; - public _prjShell: RingCoordinates; + //@interlal + _holes: RingsCoordinates; + //@interlal + _prjHoles: RingsCoordinates; + //@interlal + _prjShell: RingCoordinates; + //@interlal _getShell?(): RingCoordinates; /** * @param {Number[][]|Number[][][]|Coordinate[]|Coordinate[][]} coordinates - coordinates, shell coordinates or all the rings. @@ -171,6 +175,7 @@ export class Polygon extends Path { return this.getHoles().length > 0; } + //@interlal _projectRings(): void { if (!this.getMap()) { this.onShapeChanged(); @@ -181,11 +186,13 @@ export class Polygon extends Path { this.onShapeChanged(); } + //@interlal _setPrjCoordinates(prjCoords: RingCoordinates): void { this._prjCoords = prjCoords; this.onShapeChanged(); } + //@interlal _cleanRing(ring: RingCoordinates) { for (let i = ring.length - 1; i >= 0; i--) { if (!ring[i]) { @@ -202,6 +209,7 @@ export class Polygon extends Path { * @return {Boolean} is ring a closed one * @private */ + //@interlal _checkRing(ring: RingCoordinates): boolean { this._cleanRing(ring); if (!ring || !isArrayHasData(ring)) { @@ -221,6 +229,7 @@ export class Polygon extends Path { * If the first coordinate is equal with the last one, then remove the last coordinates. * @private */ + //@interlal _trimRing(ring: RingCoordinates): RingCoordinates { const isClose = this._checkRing(ring); if (isArrayHasData(ring) && isClose) { @@ -235,6 +244,7 @@ export class Polygon extends Path { * If the first coordinate is different with the last one, then copy the first coordinates and add to the ring. * @private */ + //@interlal _copyAndCloseRing(ring: RingCoordinates): RingCoordinates { ring = ring.slice(0); const isClose = this._checkRing(ring); @@ -246,6 +256,7 @@ export class Polygon extends Path { } } + //@interlal _getPrjShell(): RingCoordinates { if (this.getJSONType() === JSON_TYPE) { return this._getPrjCoordinates(); @@ -258,6 +269,7 @@ export class Polygon extends Path { return this._prjShell; } + //@interlal _getPrjHoles(): RingsCoordinates { const projection = this._getProjection(); this._verifyProjection(); @@ -267,6 +279,7 @@ export class Polygon extends Path { return this._prjHoles; } + //@interlal _computeGeodesicLength(measurer: any): number { const rings = this.getCoordinates(); if (!isArrayHasData(rings)) { @@ -279,6 +292,7 @@ export class Polygon extends Path { return result; } + //@interlal _computeGeodesicArea(measurer: any): number { const rings = this.getCoordinates(); if (!isArrayHasData(rings)) { @@ -293,6 +307,7 @@ export class Polygon extends Path { return result; } + //@interlal _updateCache(): void { super._updateCache(); if (this._prjHoles) { @@ -300,11 +315,13 @@ export class Polygon extends Path { } } + //@interlal _clearCache(): any { delete this._prjShell; return super._clearCache(); } + //@interlal _clearProjection(): void { if (this._prjHoles) { this._prjHoles = null; diff --git a/src/geometry/QuadBezierCurve.ts b/src/geometry/QuadBezierCurve.ts index b899961b6c..1ded540b98 100644 --- a/src/geometry/QuadBezierCurve.ts +++ b/src/geometry/QuadBezierCurve.ts @@ -29,6 +29,7 @@ class QuadBezierCurve extends Curve { return curve; } + //@interlal _toJSON(options: any): any { return { 'feature': this.toGeoJSON(options), @@ -37,6 +38,7 @@ class QuadBezierCurve extends Curve { } // paint method on canvas + //@interlal _paintOn(ctx: CanvasRenderingContext2D, points: any, lineOpacity: number) { ctx.beginPath(); ctx.moveTo(points[0].x, points[0].y); @@ -46,6 +48,7 @@ class QuadBezierCurve extends Curve { this._paintArrow(ctx, points, lineOpacity); } + //@interlal _getArrowPoints(arrows: any[], segments: [], lineWidth: number, arrowStyle: any, tolerance: any) { return this._getCurveArrowPoints(arrows, segments, lineWidth, arrowStyle, tolerance, 2); } diff --git a/src/geometry/Rectangle.ts b/src/geometry/Rectangle.ts index 8ddcf2d3ce..4a96796ffd 100644 --- a/src/geometry/Rectangle.ts +++ b/src/geometry/Rectangle.ts @@ -17,10 +17,14 @@ import Polygon, { PolygonOptionsType, RingCoordinates, RingsCoordinates } from ' */ export class Rectangle extends Polygon { // @ts-expect-error 确实需要重写父类的属性 + //@interlal _coordinates: Coordinate; - public _width: number - public _height: number - public _pnw: any + //@interlal + _width: number + //@interlal + _height: number + //@interlal + _pnw: any static fromJSON(json): Rectangle { const feature = json['feature']; @@ -122,6 +126,7 @@ export class Rectangle extends Polygon { return this._getShell(); } + //@interlal _getShell(): RingCoordinates { const measurer = this._getMeasurer(); const nw = this._coordinates; @@ -165,6 +170,7 @@ export class Rectangle extends Polygon { } // @ts-expect-error 确实需要重写父类的属性 + //@interlal _getPrjCoordinates(): Coordinate { const projection = this._getProjection(); this._verifyProjection(); @@ -176,11 +182,13 @@ export class Rectangle extends Polygon { return this._pnw; } + //@interlal _setPrjCoordinates(pnw) { this._pnw = pnw; this.onPositionChanged(); } + //@interlal _getPrjShell(): RingCoordinates { const shell = super._getPrjShell(); const projection = this._getProjection(); @@ -209,6 +217,7 @@ export class Rectangle extends Polygon { } //update cached variables if geometry is updated. + //@interlal _updateCache() { this._clearCache(); const projection = this._getProjection(); @@ -217,15 +226,18 @@ export class Rectangle extends Polygon { } } + //@interlal _clearProjection() { this._pnw = null; super._clearProjection(); } + //@interlal _computeCenter(measurer?: any): Coordinate { return measurer.locate(this._coordinates, this._width / 2, -this._height / 2); } + //@interlal _containsPoint(point: Point, tolerance?: number) { const map = this.getMap(); if (map.isTransforming()) { @@ -238,6 +250,7 @@ export class Rectangle extends Polygon { return extent.contains(p); } + //@interlal _computePrjExtent(projection: CommonProjectionType): Extent { if (this.isRotated()) { return this._computeRotatedPrjExtent(); @@ -253,6 +266,7 @@ export class Rectangle extends Polygon { return new Extent(prjs[0] as Coordinate, prjs[1] as Coordinate); } + //@interlal _computeExtent(measurer?: any): Extent { const se = this._getSouthEast(measurer); if (!se) { @@ -261,6 +275,7 @@ export class Rectangle extends Polygon { return new Extent(this._coordinates, se, this._getProjection()); } + //@interlal _getSouthEast(measurer): Coordinate { if (!measurer || !this._coordinates || isNil(this._width) || isNil(this._height)) { return null; @@ -282,6 +297,7 @@ export class Rectangle extends Polygon { return rightPoint; } + //@interlal _computeGeodesicLength() { if (isNil(this._width) || isNil(this._height)) { return 0; @@ -289,6 +305,7 @@ export class Rectangle extends Polygon { return 2 * (this._width + this._height); } + //@interlal _computeGeodesicArea() { if (isNil(this._width) || isNil(this._height)) { return 0; @@ -296,6 +313,7 @@ export class Rectangle extends Polygon { return this._width * this._height; } + //@interlal _exportGeoJSONGeometry() { const coordinates = Coordinate.toNumberArrays([this.getShell()]); return { @@ -304,6 +322,7 @@ export class Rectangle extends Polygon { }; } + //@interlal _toJSON(options) { const opts = extend({}, options); const nw = this.getCoordinates(); diff --git a/src/geometry/Sector.ts b/src/geometry/Sector.ts index 5c604fd832..32124ca38b 100644 --- a/src/geometry/Sector.ts +++ b/src/geometry/Sector.ts @@ -26,8 +26,8 @@ const options = { * }); */ export class Sector extends Circle { - public startAngle: number - public endAngle: number + startAngle: number + endAngle: number static fromJSON(json: Record): Sector { const feature = json['feature']; @@ -90,6 +90,7 @@ export class Sector extends Circle { } // The corrected angle is used for calculation and rendering + //@interlal _correctAngles(): [number, number] { let startAngle = this.getStartAngle(), endAngle = this.getEndAngle(); if (endAngle < startAngle) { @@ -121,6 +122,7 @@ export class Sector extends Circle { return this._getShell(); } + //@interlal _getShell(): RingCoordinates { const [startAngle, endAngle] = this._correctAngles(); @@ -149,11 +151,13 @@ export class Sector extends Circle { return 90; } + //@interlal _getPrjShell(): RingCoordinates { const shell = super._getPrjShell(); return this._rotatePrjCoordinates(shell) as RingCoordinates; } + //@interlal _computePrjExtent(): Extent { if (this.isRotated()) { return this._computeRotatedPrjExtent(); @@ -162,6 +166,7 @@ export class Sector extends Circle { return Circle.prototype._computePrjExtent.apply(this, arguments); } + //@interlal _containsPoint(point: Point, tolerance?: number) { const map = this.getMap(); if (map.isTransforming()) { @@ -190,6 +195,7 @@ export class Sector extends Circle { return pp.distanceTo(pc) <= (size.width / 2 + t) && between; } + //@interlal _computeGeodesicLength() { if (isNil(this._radius)) { return 0; @@ -198,6 +204,7 @@ export class Sector extends Circle { return Math.PI * 2 * this._radius * Math.abs(startAngle - endAngle) / 360 + 2 * this._radius; } + //@interlal _computeGeodesicArea() { if (isNil(this._radius)) { return 0; @@ -206,6 +213,7 @@ export class Sector extends Circle { return Math.PI * Math.pow(this._radius, 2) * Math.abs(startAngle - endAngle) / 360; } + //@interlal _toJSON(options) { const opts = extend({}, options); const center = this.getCenter(); diff --git a/src/geometry/TextBox.ts b/src/geometry/TextBox.ts index 090274f143..f8a69e221e 100644 --- a/src/geometry/TextBox.ts +++ b/src/geometry/TextBox.ts @@ -66,10 +66,14 @@ const options: TextBoxOptionsType = { class TextBox extends TextMarker { options: TextBoxOptionsType; - public _width: number - public _height: number - public _oldWidth: any - public _oldHeight: any + //@interlal + _width: number + //@interlal + _height: number + //@interlal + _oldWidth: any + //@interlal + _oldHeight: any /** * @param {String} content - TextBox's text content * @param {Coordinate} coordinates - coordinates @@ -201,6 +205,7 @@ class TextBox extends TextMarker { return textBox; } + //@interlal _toJSON(options: any) { return { 'feature': this.toGeoJSON(options), @@ -211,6 +216,7 @@ class TextBox extends TextMarker { }; } + //@interlal _refresh(): void { const textStyle = this.getTextStyle() || {}, padding = textStyle['padding'] || [12, 8]; diff --git a/src/geometry/TextMarker.ts b/src/geometry/TextMarker.ts index a8b69a1643..5309ac219a 100644 --- a/src/geometry/TextMarker.ts +++ b/src/geometry/TextMarker.ts @@ -30,8 +30,11 @@ const defaultBoxSymbol: VectorMarkerSymbol = { * @extends Marker */ class TextMarker extends Marker { - public _content: string - public _refreshing: boolean + //@interlal + _content: string + //@interlal + _refreshing: boolean + //@interlal _refresh?(): void getTextStyle?(): any setTextStyle?(tyle?: any): any @@ -108,6 +111,7 @@ class TextMarker extends Marker { return this; } + //@interlal _parseSymbol(symbol: any): any { const t = {}; const b = {}; @@ -123,22 +127,27 @@ class TextMarker extends Marker { return [t, b]; } + //@interlal _getTextSize(symbol: any): any { return splitTextToRow(this._content, symbol)['size']; } + //@interlal _getInternalSymbol(): any { return this._symbol; } + //@interlal _getDefaultTextSymbol(): TextSymbol { return extend({}, defaultSymbol); } + //@interlal _getDefaultBoxSymbol(): VectorMarkerSymbol { return extend({}, defaultBoxSymbol); } + //@interlal _getDefaultPadding(): [number, number] { return [12, 8]; } diff --git a/src/geometry/editor/GeometryEditor.ts b/src/geometry/editor/GeometryEditor.ts index 0ce1cb99c6..be70a02484 100644 --- a/src/geometry/editor/GeometryEditor.ts +++ b/src/geometry/editor/GeometryEditor.ts @@ -61,17 +61,27 @@ const options: GeometryEditOptionsType = { */ class GeometryEditor extends Eventable(Class) { - public _geometry: any; - private _originalSymbol: any - private _shadowLayer: any - private _shadow: any - private _geometryDraggble: boolean - private _history: any - private _historyPointer: any - private _editOutline: any - private _refreshHooks: Array - private _updating: boolean - public editing: boolean; + //@interlal + _geometry: any; + //@interlal + _originalSymbol: any + //@interlal + _shadowLayer: any + //@interlal + _shadow: any + //@interlal + _geometryDraggble: boolean + //@interlal + _history: any + //@interlal + _historyPointer: any + //@interlal + _editOutline: any + //@interlal + _refreshHooks: Array + //@interlal + _updating: boolean + editing: boolean; options: GeometryEditOptionsType; /** @@ -119,6 +129,7 @@ class GeometryEditor extends Eventable(Class) { this._prepareEditStageLayer(); } + //@interlal _prepareEditStageLayer(): void { const layer = this._geometry.getLayer(); if (layer.options['renderer'] !== 'canvas') { @@ -258,6 +269,7 @@ class GeometryEditor extends Eventable(Class) { return this.editing; } + //@interlal _getGeometryEvents(): GeometryEvents { return { 'symbolchange': this._onGeoSymbolChange, @@ -268,6 +280,7 @@ class GeometryEditor extends Eventable(Class) { }; } + //@interlal _switchGeometryEvents(oper: any): void { if (this._geometry) { const events = this._getGeometryEvents(); @@ -277,12 +290,14 @@ class GeometryEditor extends Eventable(Class) { } } + //@interlal _onGeoSymbolChange(param: any): void { if (this._shadow) { this._shadow.setSymbol(param.target._getInternalSymbol()); } } + //@interlal _onMarkerDragEnd(): void { this._update('setCoordinates', this._shadow.getCoordinates().toArray()); } @@ -293,6 +308,7 @@ class GeometryEditor extends Eventable(Class) { * create rectangle outline of the geometry * @private */ + //@interlal _createOrRefreshOutline(): any { const geometry = this._geometry; const outline = this._editOutline; @@ -316,6 +332,7 @@ class GeometryEditor extends Eventable(Class) { } + //@interlal _createCenterHandle(): void { const map = this.getMap(); const symbol = this.options['centerHandleSymbol']; @@ -355,6 +372,7 @@ class GeometryEditor extends Eventable(Class) { }); } + //@interlal _createHandleInstance(containerPoint: any, opts: any): EditHandle { const map = this.getMap(); const symbol = loadFunctionTypes(opts['symbol'], (): any => { @@ -454,6 +472,7 @@ class GeometryEditor extends Eventable(Class) { * @param {fn} onHandleMove callback * @private */ + //@interlal _createResizeHandles(blackList: Array, onHandleMove: any, onHandleUp: any): any { //cursor styles. const cursors = [ @@ -1206,6 +1225,7 @@ class GeometryEditor extends Eventable(Class) { }); } + //@interlal _refresh(): void { if (this._refreshHooks) { for (let i = this._refreshHooks.length - 1; i >= 0; i--) { @@ -1214,6 +1234,7 @@ class GeometryEditor extends Eventable(Class) { } } + //@interlal _hideContext(): void { if (this._geometry) { this._geometry.closeMenu(); @@ -1221,6 +1242,7 @@ class GeometryEditor extends Eventable(Class) { } } + //@interlal _addRefreshHook(fn: any): void { if (!fn) { return; @@ -1231,11 +1253,13 @@ class GeometryEditor extends Eventable(Class) { this._refreshHooks.push(fn); } + //@interlal _update(method: any, ...args: any): void { this._exeHistory([method, args]); this._recordHistory(method, ...args); } + //@interlal _updateCoordFromShadow(ignoreRecord?: any): void { const geoToEdit = this._shadow || this._geometry; @@ -1250,6 +1274,7 @@ class GeometryEditor extends Eventable(Class) { this._updating = updating; } + //@interlal _recordHistory(method: any, ...args: any): void { if (!this._history) { this._history = []; @@ -1322,6 +1347,7 @@ class GeometryEditor extends Eventable(Class) { return this; } + //@interlal _exeAndReset(record: any): void { if (this._updating) { return; @@ -1335,14 +1361,17 @@ class GeometryEditor extends Eventable(Class) { this.start(); } + //@interlal _onDragStart(): void { this._updating = true; } + //@interlal _onDragEnd(): void { this._updating = false; } + //@interlal _exeHistory(record: any): void { if (!Array.isArray(record)) { return; diff --git a/src/geometry/editor/TextEditable.ts b/src/geometry/editor/TextEditable.ts index d88913b6b7..1dc80dd05d 100644 --- a/src/geometry/editor/TextEditable.ts +++ b/src/geometry/editor/TextEditable.ts @@ -95,6 +95,7 @@ const TextEditable = { return this._editUIMarker; }, + //@interlal _prepareEditor(): void { const map = this.getMap(); const editContainer = this._createEditor(); @@ -111,6 +112,7 @@ const TextEditable = { this._setCursorToLast(this._textEditor); }, + //@interlal _getEditorOffset(): object { const symbol = this._getInternalSymbol() || {}; let dx = 0, @@ -129,6 +131,7 @@ const TextEditable = { }; }, + //@interlal _createEditor(): HTMLElement { const content = this.getContent(); const labelSize = this.getSize(), @@ -159,6 +162,7 @@ const TextEditable = { return editor; }, + //@interlal _setCursorToLast(obj) { let range; if (window.getSelection) { diff --git a/src/geometry/ext/Geometry.Animation.ts b/src/geometry/ext/Geometry.Animation.ts index 77c5e44666..005f4feaf8 100644 --- a/src/geometry/ext/Geometry.Animation.ts +++ b/src/geometry/ext/Geometry.Animation.ts @@ -10,7 +10,8 @@ type AnimationStyles = { [key: string]: any }; declare module "../Geometry" { interface Geometry { - _animPlayer: Player; + //@interlal + _animPlayer: Player; animate(styles: AnimationStyles, options?: AnimationOptionsType | ((frame: Frame) => void), step?: (frame: Frame) => void): Player; } } @@ -132,6 +133,7 @@ Geometry.include(/** @lends Geometry.prototype */ { * @return {Object} styles * @private */ + //@interlal _prepareAnimationStyles(styles: AnimationStyles): object { const symbol = this._getInternalSymbol(); @@ -189,8 +191,9 @@ Geometry.include(/** @lends Geometry.prototype */ { * 绑定动画事件 * @english * Bind animation events - * @param {string} playState + * @param {string} playState */ + //@interlal _fireAnimateEvent(playState: string): void { if (playState === 'finished') { delete this._animationStarted; diff --git a/src/geometry/ext/Geometry.Drag.ts b/src/geometry/ext/Geometry.Drag.ts index 33f87a311f..a19f8dfbdf 100644 --- a/src/geometry/ext/Geometry.Drag.ts +++ b/src/geometry/ext/Geometry.Drag.ts @@ -23,17 +23,26 @@ const EVENTS = Browser.touch ? 'touchstart mousedown' : 'mousedown'; */ class GeometryDragHandler extends Handler { - public container: any - - private _dragHandler: any - private _shadow: any - private _dragStageLayer: any - private _shadowConnectors: any - private _lastCoord: any - private _lastPoint: any - private _startParam: any - private _moved: boolean - private _isDragging: boolean + container: any + + //@interlal + _dragHandler: any + //@interlal + _shadow: any + //@interlal + _dragStageLayer: any + //@interlal + _shadowConnectors: any + //@interlal + _lastCoord: any + //@interlal + _lastPoint: any + //@interlal + _startParam: any + //@interlal + _moved: boolean + //@interlal + _isDragging: boolean /** @@ -53,6 +62,7 @@ class GeometryDragHandler extends Handler { delete this.container; } + //@interlal _prepareDragHandler(): void { this._dragHandler = new DragHandler(this.container); this._dragHandler.on('dragging', this._dragging, this) @@ -60,6 +70,7 @@ class GeometryDragHandler extends Handler { .enable(); } + //@interlal _prepareShadow(): void { const target = this.target; const needShadow = target.getLayer().options['renderer'] === 'canvas'; @@ -85,6 +96,7 @@ class GeometryDragHandler extends Handler { this._prepareShadowConnectors(); } + //@interlal _updateShadowSymbol(shadow: any, target: any): void { shadow.setSymbol(target._getInternalSymbol()); if (target.options['dragShadow']) { @@ -93,6 +105,7 @@ class GeometryDragHandler extends Handler { } } + //@interlal _prepareShadowConnectors(): void { //copy connectors const target = this.target; @@ -125,12 +138,14 @@ class GeometryDragHandler extends Handler { this._dragStageLayer.bringToFront().addGeometry(shadowConnectors); } + //@interlal _onTargetUpdated(): void { if (this._shadow) { this._shadow.setSymbol(this.target._getSymbol()); } } + //@interlal _prepareDragStageLayer(): void { const map = this.target.getMap(), layer = this.target.getLayer(); @@ -148,6 +163,7 @@ class GeometryDragHandler extends Handler { this._dragStageLayer._getRenderer().resources = resources; } + //@interlal _startDrag(param: any): void { const map = this.target.getMap(); if (!map) { @@ -178,6 +194,7 @@ class GeometryDragHandler extends Handler { return; } + //@interlal _dragging(param: any): void { const target = this.target; const map = target.getMap(); @@ -278,6 +295,7 @@ class GeometryDragHandler extends Handler { } } + //@interlal _endDrag(param?: any): void { if (this._dragHandler) { this._dragHandler.disable(); @@ -332,6 +350,7 @@ class GeometryDragHandler extends Handler { return true; } + //@interlal _updateTargetAndRemoveShadow(eventParam: any): void { if (!this._shadow) { return; @@ -364,6 +383,7 @@ class GeometryDragHandler extends Handler { } //find correct coordinate for coordOffset if geometry has altitude + //@interlal _correctCoord(coord: any): any { const map = this.target.getMap(); if (!map.getPitch()) { diff --git a/src/geometry/ext/Geometry.Events.ts b/src/geometry/ext/Geometry.Events.ts index ee06364fb9..1c41d93553 100644 --- a/src/geometry/ext/Geometry.Events.ts +++ b/src/geometry/ext/Geometry.Events.ts @@ -6,7 +6,8 @@ import Geometry from '../Geometry'; declare module "../Geometry" { interface Geometry { - _onEvent(event: MouseEvent | TouchEvent, type?: string): void; + //@interlal + _onEvent(event: MouseEvent | TouchEvent, type?: string): void; } } @@ -19,6 +20,7 @@ Geometry.include(/** @lends Geometry.prototype */ { * @param {Event} event - dom event * @private */ + //@interlal _onEvent(event: MouseEvent | TouchEvent, type: string): void { const map = this.getMap(); if (!map) { @@ -44,6 +46,7 @@ Geometry.include(/** @lends Geometry.prototype */ { * @param {any} domEvent * @returns */ + //@interlal _getEventTypeToFire(domEvent: any): string { // let eventType = domEvent.type; // //change event type to contextmenu diff --git a/src/geometry/ext/Geometry.InfoWindow.ts b/src/geometry/ext/Geometry.InfoWindow.ts index 6d27ed3608..7ceaa7b4f3 100644 --- a/src/geometry/ext/Geometry.InfoWindow.ts +++ b/src/geometry/ext/Geometry.InfoWindow.ts @@ -7,14 +7,17 @@ import type Coordinate from '../../geo/Coordinate'; declare module "../Geometry" { interface Geometry { - _infoWindow: InfoWindow; + //@interlal + _infoWindow: InfoWindow; setInfoWindow(options: InfoWindowOptionsType): this; getInfoWindow(): InfoWindow; openInfoWindow(coordinate?: Coordinate): this; closeInfoWindow(): this; removeInfoWindow(): this; - _bindInfoWindow(): this; - _unbindInfoWindow(): this; + //@interlal + _bindInfoWindow(): this; + //@interlal + _unbindInfoWindow(): this; } } @@ -120,6 +123,7 @@ Geometry.include(/** @lends Geometry.prototype */ { * Bing InfoWindow to Geometry * @returns {Geometry} this */ + //@interlal _bindInfoWindow() { const options = this._infoWinOptions; if (!options) { @@ -137,6 +141,7 @@ Geometry.include(/** @lends Geometry.prototype */ { * Unbind InfoWindow * @returns {Geometry} this */ + //@interlal _unbindInfoWindow() { if (this._infoWindow) { this.closeInfoWindow(); diff --git a/src/handler/Drag.ts b/src/handler/Drag.ts index 675195b702..e4522fbfb1 100644 --- a/src/handler/Drag.ts +++ b/src/handler/Drag.ts @@ -26,6 +26,7 @@ const END_EVENTS = { class DragHandler extends Handler { options: DragOptionsType; + //@interlal _onMouseDown: (e: any) => any; moved: boolean; startPos: Point; @@ -156,6 +157,7 @@ class DragHandler extends Handler { this.fire('mouseup', param); } + //@interlal _offEvents() { const dom = this.dom; off(dom, 'mouseleave', this.onMouseUp); diff --git a/src/handler/Handler.ts b/src/handler/Handler.ts index aa594beb91..5c699251de 100644 --- a/src/handler/Handler.ts +++ b/src/handler/Handler.ts @@ -14,6 +14,7 @@ class Base {} abstract class Handler extends Eventable(Base) { target: any; dom?: HTMLElement; + //@interlal _enabled: boolean = false; constructor(target: any) { diff --git a/src/handler/Handlerable.ts b/src/handler/Handlerable.ts index c2e932b207..78d309f509 100644 --- a/src/handler/Handlerable.ts +++ b/src/handler/Handlerable.ts @@ -10,7 +10,8 @@ import Handler from "./Handler"; export default function (Base: T) { return class Handlerable extends Base { - _handlers?: Handler[]; + //@interlal + _handlers?: Handler[]; /** * Register a handler * @param {String} name - name of the handler @@ -66,7 +67,8 @@ export default function (Base: T) { return this; } - _clearHandlers() { + //@interlal + _clearHandlers() { for (let i = 0, len = this._handlers.length; i < len; i++) { this._handlers[i].remove(); } diff --git a/src/lang/translator.ts b/src/lang/translator.ts index a5eb063c74..763452c9cc 100644 --- a/src/lang/translator.ts +++ b/src/lang/translator.ts @@ -67,6 +67,7 @@ class Translator extends Class { this.nodes = newLanguageNodes; } + //@interlal _validateNestedProps(nestedProps: string[]) { nestedProps.forEach(p => { if (p === '') throw new TranslatorError('Any of sides of a dot "." cannot be empty'); diff --git a/src/layer/CanvasLayer.ts b/src/layer/CanvasLayer.ts index 64414153ee..a34ac2d541 100644 --- a/src/layer/CanvasLayer.ts +++ b/src/layer/CanvasLayer.ts @@ -268,6 +268,7 @@ class CanvasLayer extends Layer { return this; } + //@interlal _getRenderer() { return super._getRenderer() as CanvasLayerRenderer; } diff --git a/src/layer/ImageLayer.ts b/src/layer/ImageLayer.ts index b29e1bf18c..824460604b 100644 --- a/src/layer/ImageLayer.ts +++ b/src/layer/ImageLayer.ts @@ -52,7 +52,9 @@ const TEMP_POINT = new Point(0, 0); }]) */ class ImageLayer extends Layer { + //@interlal _images: Array; + //@interlal _imageData: Array; constructor(id: string, images?: ImageLayerOptionsType | Array, options?: ImageLayerOptionsType) { @@ -93,6 +95,7 @@ class ImageLayer extends Layer { return this._images; } + //@interlal _prepareImages(images: Array) { images = images || []; if (!Array.isArray(images)) { @@ -128,6 +131,7 @@ ImageLayer.mergeOptions(options); const EMPTY_ARRAY = []; export class ImageLayerCanvasRenderer extends CanvasRenderer { + //@interlal _imageLoaded: boolean isDrawable() { @@ -194,6 +198,7 @@ export class ImageLayerCanvasRenderer extends CanvasRenderer { this.completeRender(); } + //@interlal // eslint-disable-next-line @typescript-eslint/no-unused-vars _drawImages(timestamp?: number, context?: any) { const imgData = this.layer._imageData; @@ -213,6 +218,7 @@ export class ImageLayerCanvasRenderer extends CanvasRenderer { } } + //@interlal _drawImage(image: LayerImageType, extent: PointExtent, opacity: number) { let globalAlpha = 0; const ctx = this.context; @@ -254,6 +260,7 @@ export class ImageLayerGLRenderer extends ImageGLRenderable(ImageLayerCanvasRend this.draw(timestamp, context); } + //@interlal _prepareGLContext() { const gl = this.gl; if (gl) { @@ -268,6 +275,7 @@ export class ImageLayerGLRenderer extends ImageGLRenderable(ImageLayerCanvasRend } } + //@interlal _drawImages(timestamp?: number, parentContext?: any) { const gl = this.gl; if (parentContext && parentContext.renderTarget) { @@ -292,6 +300,7 @@ export class ImageLayerGLRenderer extends ImageGLRenderable(ImageLayerCanvasRend return true; } + //@interlal _drawImage(image: LayerImageType, extent: PointExtent, opacity: number) { this.drawGLImage(image, extent.xmin, extent.ymax, extent.getWidth(), extent.getHeight(), 1, opacity); } diff --git a/src/layer/Layer.ts b/src/layer/Layer.ts index 198536da4b..6ab93b46ad 100644 --- a/src/layer/Layer.ts +++ b/src/layer/Layer.ts @@ -74,18 +74,30 @@ const options: LayerOptionsType = { * @mixes Renderable */ class Layer extends JSONAble(Eventable(Renderable(Class))) { + //@interlal _canvas: HTMLCanvasElement; + //@interlal _renderer: CanvasRenderer; + //@interlal _id: string + //@interlal _zIndex: number + //@interlal _drawTime: number + //@interlal _toRedraw: boolean map: Map + //@interlal _mask: Polygon | MultiPolygon | Marker; + //@interlal _maskGeoJSON: Record; + //@interlal _loaded: boolean + //@interlal _collisionIndex: CollisionIndex + //@interlal _optionsHook?(conf?: any): void + //@interlal _silentConfig: boolean | undefined | any options: LayerOptionsType; getLayers?(): Layer[]; @@ -687,6 +699,7 @@ class Layer extends JSONAble(Eventable(Renderable(Class))) { onRemove() { } + //@interlal _bindMap(map: Map, zIndex?: number) { if (!map) { return; @@ -702,6 +715,7 @@ class Layer extends JSONAble(Eventable(Renderable(Class))) { this.fire('add'); } + //@interlal _initRenderer() { const renderer = this.options['renderer']; // eslint-disable-next-line @typescript-eslint/ban-ts-comment @@ -744,6 +758,7 @@ class Layer extends JSONAble(Eventable(Renderable(Class))) { }); } + //@interlal _doRemove() { this._loaded = false; @@ -758,16 +773,19 @@ class Layer extends JSONAble(Eventable(Renderable(Class))) { delete this._collisionIndex; } + //@interlal _switchEvents(to, emitter) { if (emitter && emitter.getEvents && this.getMap()) { this.getMap()[to](emitter.getEvents(), emitter); } } + //@interlal _getRenderer() { return this._renderer; } + //@interlal _getLayerList() { if (!this.map) { return []; @@ -776,6 +794,7 @@ class Layer extends JSONAble(Eventable(Renderable(Class))) { return this.map.getLayers().slice(beginIndex); } + //@interlal _getMask2DExtent() { if (!this._mask || !this.getMap()) { return null; diff --git a/src/layer/OverlayLayer.ts b/src/layer/OverlayLayer.ts index e46bb2ad6e..78b6c76d68 100644 --- a/src/layer/OverlayLayer.ts +++ b/src/layer/OverlayLayer.ts @@ -33,7 +33,7 @@ const TMP_EVENTS_ARR = []; /** * layers 的基础类,可用于 geometries 的添加移除 * 抽象类,不准备实例化 - * + * * @english * @classdesc * Base class of all the layers that can add/remove geometries.
@@ -43,14 +43,22 @@ const TMP_EVENTS_ARR = []; * @extends Layer */ class OverlayLayer extends Layer { + //@interlal _maxZIndex: number + //@interlal _minZIndex: number + //@interlal _geoMap: Record; + //@interlal _geoList: Array + //@interlal _toSort: boolean + //@interlal _cookedStyles: any + //@interlal _clearing: boolean options: OverlayLayerOptionsType; + //@interlal _renderer: OverlayLayerCanvasRenderer; constructor(id: string, geometries: OverlayLayerOptionsType | Array, options?: OverlayLayerOptionsType) { @@ -101,7 +109,7 @@ class OverlayLayer extends Layer { /** * 通过 id 获取 geometry - * + * * @english * Get a geometry by its id * @param id - id of the geometry @@ -119,7 +127,7 @@ class OverlayLayer extends Layer { /** * 获取所有geometries,如果提供 filter() 方法,则根据方法返回 - * + * * @english * Get all the geometries or the ones filtered if a filter function is provided. * @param filter=undefined - a function to filter the geometries @@ -148,7 +156,7 @@ class OverlayLayer extends Layer { /** * 获取第一个geometry, geometry 位于底部 - * + * * @english * Get the first geometry, the geometry at the bottom. * @return first geometry @@ -162,7 +170,7 @@ class OverlayLayer extends Layer { /** * 获取最后一个geometry, geometry 位于上部 - * + * * @english * Get the last geometry, the geometry on the top * @return last geometry @@ -177,7 +185,7 @@ class OverlayLayer extends Layer { /** * 获取 geometries 个数 - * + * * Get count of the geometries * @return count */ @@ -187,7 +195,7 @@ class OverlayLayer extends Layer { /** * 获取 geometries 的 extent, 如果 layer 为空,返回 null - * + * * @english * Get extent of all the geometries in the layer, return null if the layer is empty. * @return {Extent} - extent of the layer @@ -207,7 +215,7 @@ class OverlayLayer extends Layer { /** * 按顺序为图层中的每个 geometry 执行一次提供的回调。 - * + * * @english * Executes the provided callback once for each geometry present in the layer in order. * @param fn - a callback function @@ -228,7 +236,7 @@ class OverlayLayer extends Layer { /** * 创建一个包含所有通过由提供的函数实现的测试的 geometries 的 GeometryCollection。 - * + * * @english * Creates a GeometryCollection with all the geometries that pass the test implemented by the provided function. * @param fn - Function to test each geometry @@ -251,7 +259,7 @@ class OverlayLayer extends Layer { /** * layer 是否为空 - * + * * @english * Whether the layer is empty. * @return {Boolean} @@ -262,7 +270,7 @@ class OverlayLayer extends Layer { /** * 为 layer 添加 geometries - * + * * @english * Adds one or more geometries to the layer * @param geometries - one or more geometries @@ -359,7 +367,7 @@ class OverlayLayer extends Layer { } /** * addgeo 事件 - * + * * addgeo event. * * @event OverlayLayer#addgeo @@ -378,7 +386,7 @@ class OverlayLayer extends Layer { /** * 所有 geometries 最小的 zIndex - * + * * @english * Get minimum zindex of geometries */ @@ -388,7 +396,7 @@ class OverlayLayer extends Layer { /** * 所有 geometries 最大的 zIndex - * + * * @english * Get maximum zindex of geometries */ @@ -397,6 +405,7 @@ class OverlayLayer extends Layer { } + //@interlal _add(geo: Geometry, extent?: Extent, i?: number) { if (!this._toSort) { this._toSort = geo.getZIndex() !== 0; @@ -422,7 +431,7 @@ class OverlayLayer extends Layer { } /** * add 事件 - * + * * @english * add event. * @@ -442,7 +451,7 @@ class OverlayLayer extends Layer { /** * 移除一个或多个geometries - * + * * @english * Removes one or more geometries from the layer * @param geometries - geometry ids or geometries to remove @@ -461,8 +470,8 @@ class OverlayLayer extends Layer { } /** * removegeo 事件 - * - * @english + * + * @english * removegeo event. * * @event OverlayLayer#removegeo @@ -481,7 +490,7 @@ class OverlayLayer extends Layer { /** * 清除 layer - * + * * @english * Clear all geometries in this layer * @returns this @@ -505,7 +514,7 @@ class OverlayLayer extends Layer { this._clearing = false; /** * clear 事件 - * + * * @english * clear event. * @@ -520,7 +529,7 @@ class OverlayLayer extends Layer { /** * 移除geometry 回调函数 - * + * * @english * Called when geometry is being removed to clear the context concerned. * @param geometry - the geometry instance to remove @@ -551,7 +560,7 @@ class OverlayLayer extends Layer { /** * 获取 layer 的 style - * + * * @english * Gets layer's style. * @return layer's style @@ -566,7 +575,7 @@ class OverlayLayer extends Layer { /** * layer 设置 style, 用样式符号对满足条件的 geometries进行样式修改 * 基于[mapbox-gl-js's style specification], {https://www.mapbox.com/mapbox-gl-js/style-spec/#types-filter}. - * + * * @english * Sets style to the layer, styling the geometries satisfying the condition with style's symbol.
* Based on filter type in [mapbox-gl-js's style specification]{https://www.mapbox.com/mapbox-gl-js/style-spec/#types-filter}. @@ -611,6 +620,7 @@ class OverlayLayer extends Layer { return this; } + //@interlal _styleGeometry(geometry: Geometry): boolean { if (!this._cookedStyles) { return false; @@ -627,7 +637,7 @@ class OverlayLayer extends Layer { /** * 移除 style - * + * * @english * Removes layers' style * @returns this @@ -670,6 +680,7 @@ class OverlayLayer extends Layer { return Layer.prototype.hide.call(this); } + //@interlal _initCache() { if (!this._geoList) { this._geoList = []; @@ -677,11 +688,13 @@ class OverlayLayer extends Layer { } } + //@interlal _updateZIndex(...zIndex: number[]) { this._maxZIndex = Math.max(this._maxZIndex, Math.max(...zIndex)); this._minZIndex = Math.min(this._minZIndex, Math.min(...zIndex)); } + //@interlal _sortGeometries() { if (!this._toSort) { return; @@ -695,6 +708,7 @@ class OverlayLayer extends Layer { this._toSort = false; } + //@interlal _compare(a, b) { if (a.getZIndex() === b.getZIndex()) { return a._getInternalId() - b._getInternalId(); @@ -703,6 +717,7 @@ class OverlayLayer extends Layer { } //binarySearch + //@interlal _findInList(geo: Geometry): number { const len = this._geoList.length; if (len === 0) { @@ -725,6 +740,7 @@ class OverlayLayer extends Layer { return -1; } + //@interlal _onGeometryEvent(param?: HandlerFnResultType) { if (!param || !param['target']) { return; @@ -749,6 +765,7 @@ class OverlayLayer extends Layer { } } + //@interlal _onGeometryIdChange(param: HandlerFnResultType) { if (param['new'] === param['old']) { if (this._geoMap[param['old']] && this._geoMap[param['old']] === param['target']) { @@ -767,6 +784,7 @@ class OverlayLayer extends Layer { } + //@interlal _onGeometryZIndexChange(param: HandlerFnResultType) { if (param['old'] !== param['new']) { this._updateZIndex(param['new']); @@ -777,42 +795,49 @@ class OverlayLayer extends Layer { } } + //@interlal _onGeometryPositionChange(param: HandlerFnResultType) { if (this._getRenderer()) { this._getRenderer().onGeometryPositionChange(param); } } + //@interlal _onGeometryShapeChange(param: HandlerFnResultType) { if (this._getRenderer()) { this._getRenderer().onGeometryShapeChange(param); } } + //@interlal _onGeometrySymbolChange(param: HandlerFnResultType) { if (this._getRenderer()) { this._getRenderer().onGeometrySymbolChange(param); } } + //@interlal _onGeometryShow(param: HandlerFnResultType) { if (this._getRenderer()) { this._getRenderer().onGeometryShow(param); } } + //@interlal _onGeometryHide(param: HandlerFnResultType) { if (this._getRenderer()) { this._getRenderer().onGeometryHide(param); } } + //@interlal _onGeometryPropertiesChange(param: HandlerFnResultType) { if (this._getRenderer()) { this._getRenderer().onGeometryPropertiesChange(param); } } + //@interlal _hasGeoListeners(eventTypes: string | Array): boolean { if (!eventTypes) { return false; @@ -844,6 +869,7 @@ class OverlayLayer extends Layer { } //override for typing + //@interlal _getRenderer(): OverlayLayerCanvasRenderer { return super._getRenderer() as OverlayLayerCanvasRenderer; } @@ -869,4 +895,4 @@ export type addGeometryFitViewOptions = { export type LayerIdentifyOptionsType = { onlyVisible?: boolean; tolerance?: number; -} \ No newline at end of file +} diff --git a/src/layer/ParticleLayer.ts b/src/layer/ParticleLayer.ts index dcc45bc7eb..44ac401981 100644 --- a/src/layer/ParticleLayer.ts +++ b/src/layer/ParticleLayer.ts @@ -92,6 +92,7 @@ class ParticleLayer extends CanvasLayer { this._fillCanvas(context); } + //@interlal _fillCanvas(context: CanvasRenderingContext2D) { const g = context.globalCompositeOperation; context.globalCompositeOperation = 'destination-out'; @@ -104,6 +105,7 @@ class ParticleLayer extends CanvasLayer { ParticleLayer.mergeOptions(options); ParticleLayer.registerRenderer('canvas', class extends CanvasLayerRenderer { + //@interlal _shouldClear: boolean; layer: ParticleLayer; diff --git a/src/layer/VectorLayer.ts b/src/layer/VectorLayer.ts index 4f99e42b09..3f536a904a 100644 --- a/src/layer/VectorLayer.ts +++ b/src/layer/VectorLayer.ts @@ -22,7 +22,7 @@ type VectorLayerToJSONOptions = { const TEMP_EXTENT = new PointExtent(); /** * 配置参数 - * + * * @english * @property {Object} options - VectorLayer's options * @property {Boolean} options.debug=false - whether the geometries on the layer is in debug mode. @@ -72,7 +72,7 @@ const options: VectorLayerOptionsType = { // const TYPES = ['LineString', 'Polyline', 'Polygon', 'MultiLineString', 'MultiPolygon']; /** * 用于管理、呈现 geometries 的 layer - * + * * @english * @classdesc * A layer for managing and rendering geometries. @@ -117,7 +117,7 @@ class VectorLayer extends OverlayLayer { /** * 通过给定 coordinate 识别 geometries - * + * * @english * Identify the geometries on the given coordinate * @param {maptalks.Coordinate} coordinate - coordinate to identify @@ -142,7 +142,7 @@ class VectorLayer extends OverlayLayer { /** * 通过给定 point 识别 geometries - * + * * @english * Identify the geometries on the given container point * @param {maptalks.Point} point - container point to identify @@ -164,6 +164,7 @@ class VectorLayer extends OverlayLayer { return this._hitGeos(this._geoList, point, options); } + //@interlal _hitGeos(geometries: Array, cp: Point, options: LayerIdentifyOptionsType) { if (!geometries || !geometries.length) { return []; @@ -265,7 +266,7 @@ class VectorLayer extends OverlayLayer { /** * 输出 VectorLayer 的 json - * + * * @english * Export the VectorLayer's JSON.
* @param {Object} [options=null] - export options @@ -318,7 +319,7 @@ class VectorLayer extends OverlayLayer { /** * 通过 json 生成 VectorLayer - * + * * @english * Reproduce a VectorLayer from layer's JSON. * @param {Object} layerJSON - layer's JSON @@ -383,4 +384,4 @@ export type VectorLayerOptionsType = OverlayLayerOptionsType & { progressiveRender?: boolean, progressiveRenderCount?: number, progressiveRenderDebug?: boolean -}; \ No newline at end of file +}; diff --git a/src/layer/tile/GroupTileLayer.ts b/src/layer/tile/GroupTileLayer.ts index 0a0eda5f6f..5dc873c7ff 100644 --- a/src/layer/tile/GroupTileLayer.ts +++ b/src/layer/tile/GroupTileLayer.ts @@ -49,7 +49,8 @@ function checkLayers(tileLayers: TileLayer[] | TileLayer): TileLayer[] { class GroupTileLayer extends TileLayer { layers: TileLayer[]; layerMap: Record; - private _groupChildren: any[]; + //@interlal + _groupChildren: any[]; /** * Reproduce a GroupTileLayer from layer's profile JSON. * @param layerJSON - layer's profile JSON @@ -241,6 +242,7 @@ class GroupTileLayer extends TileLayer { return null; } + //@interlal _removeChildTileCache(layer: TileLayer) { if (!layer) { return this; @@ -283,6 +285,7 @@ class GroupTileLayer extends TileLayer { return this; } + //@interlal _onLayerShowHide(e: { type: string; target: any }) { const { type, target } = e || {}; //listen tilelayer.remove() method fix #1629 @@ -300,6 +303,7 @@ class GroupTileLayer extends TileLayer { } // render all layers + //@interlal _renderLayers() { const renderer = this.getRenderer(); if (renderer) { @@ -309,6 +313,7 @@ class GroupTileLayer extends TileLayer { } // reset layerMap,_groupChildren,listen tilelayers events + //@interlal _refresh() { const map = this.getMap(); this._groupChildren = []; @@ -342,6 +347,7 @@ class GroupTileLayer extends TileLayer { return false; } + //@interlal _checkChildren() { const ids = {}; this.layers.forEach(layer => { @@ -354,6 +360,7 @@ class GroupTileLayer extends TileLayer { }); } + //@interlal _sortLayers() { this.layers.sort(function (a, b) { return a.options.zIndex - b.options.zIndex; diff --git a/src/layer/tile/TileLayer.ts b/src/layer/tile/TileLayer.ts index 55532c4f2b..9551ca5243 100644 --- a/src/layer/tile/TileLayer.ts +++ b/src/layer/tile/TileLayer.ts @@ -35,7 +35,8 @@ const MAX_ROOT_NODES = 32; const isSetAvailable: boolean = typeof Set !== 'undefined'; class TileHashset { - private _table: Set | any; + //@interlal + _table: Set | any; constructor() { this._table = isSetAvailable ? new Set() : {}; } @@ -191,20 +192,35 @@ const ARR3: Vector3 = [0, 0, 0]; */ class TileLayer extends Layer { tileInfoCache: ArrayLRUCache; + //@interlal _tileSize: Size; + //@interlal _coordCache: Record; + //@interlal _disablePyramid: boolean; + //@interlal _hasOwnSR: boolean; + //@interlal _tileFullExtent: PointExtent; + //@interlal _rootNodes: any; + //@interlal _visitedTiles: TileHashset; + //@interlal _zScale: number; + //@interlal _sr: SpatialReference; + //@interlal _srMinZoom: number; + //@interlal _srMaxZoom: number; + //@interlal _defaultTileConfig: TileConfig; + //@interlal _tileConfig: TileConfig; + //@interlal _polygonOffset: number; + //@interlal _renderer: TileLayerCanvasRenderer; options: TileLayerOptionsType; @@ -297,11 +313,13 @@ class TileLayer extends Layer { + //@interlal _isPyramidMode() { const sr = this.getSpatialReference(); return !this._disablePyramid && !this._hasOwnSR && this.options['pyramidMode'] && sr && sr.isPyramid(); } + //@interlal _getTileFullExtent(): Extent { if (this._tileFullExtent) { return this._tileFullExtent; @@ -315,6 +333,7 @@ class TileLayer extends Layer { } + //@interlal _getRootNodes(offset0: TileOffsetType): TileRootType { const map = this.getMap(); if (this._rootNodes) { @@ -415,6 +434,7 @@ class TileLayer extends Layer { }; } + //@interlal _getRootError() { const map = this.getMap(); const fov = toRadian(map.getFov()); @@ -436,6 +456,7 @@ class TileLayer extends Layer { } + //@interlal _getPyramidTiles(z: number, layer: Layer): TilesType { const map = this.getMap(); if (isNaN(+z)) { @@ -531,6 +552,7 @@ class TileLayer extends Layer { } + //@interlal _splitNode( node: TileNodeType, projectionView: Matrix4, @@ -607,6 +629,7 @@ class TileLayer extends Layer { } + //@interlal _createChildNode(node: TileNodeType, dx: number, dy: number, offset?: TileOffsetType, tileId?: string) { // const zoomOffset = this.options['zoomOffset']; const { x, y, idx, idy, extent2d } = node; @@ -641,6 +664,7 @@ class TileLayer extends Layer { return childNode; } + //@interlal _isTileVisible(node: TileNodeType, projectionView: Matrix4, glScale: number, maxZoom: number, offset: TileOffsetType) { if (node.z === 0) { return 1; @@ -694,7 +718,8 @@ class TileLayer extends Layer { // return [w, h]; // } - private _isTileInFrustum(node: TileNodeType, projectionView: Matrix4, glScale: number, offset: TileOffsetType): boolean { + //@interlal + _isTileInFrustum(node: TileNodeType, projectionView: Matrix4, glScale: number, offset: TileOffsetType): boolean { if (!this._zScale) { const map = this.getMap(); const glRes = map.getGLRes(); @@ -725,7 +750,8 @@ class TileLayer extends Layer { * from Cesium * 与cesium不同的是,我们用boundingVolume顶面的四个顶点中的最小值作为distanceToCamera */ - private _getScreenSpaceError(node: TileNodeType, glScale: number, maxZoom: number, offset: TileOffsetType) { + //@interlal + _getScreenSpaceError(node: TileNodeType, glScale: number, maxZoom: number, offset: TileOffsetType) { // const fovDenominator = this._fovDenominator; const geometricError = node.error; const map = this.getMap(); @@ -761,7 +787,8 @@ class TileLayer extends Layer { * @param z - zoom * @return tile descriptors */ - private _getCascadeTiles(z: number, parentLayer: Layer): TilesType { + //@interlal + _getCascadeTiles(z: number, parentLayer: Layer): TilesType { const map = this.getMap(); const pitch = map.getPitch(); const parentRenderer = parentLayer && parentLayer.getRenderer(); @@ -966,6 +993,7 @@ class TileLayer extends Layer { return super.getMaxZoom(); } + //@interlal _getTileZoom(zoom: number): number { if (!this._hasOwnSR) { const res0 = this.getMap().getResolution(zoom); @@ -994,6 +1022,7 @@ class TileLayer extends Layer { return this.options['maxAvailableZoom'] || sr && sr.getMaxZoom(); } + //@interlal _getTiles( tileZoom: number, containerExtent: PointExtent, @@ -1218,6 +1247,7 @@ class TileLayer extends Layer { } as TileGridType; } + //@interlal _convertToExtent2d(containerExtent: PointExtent) { const map = this.getMap(); return containerExtent.convertTo(c => { @@ -1234,6 +1264,7 @@ class TileLayer extends Layer { }); } + //@interlal _splitTiles( frustumMatrix: Matrix4, tiles: TileNodeType[], @@ -1268,6 +1299,7 @@ class TileLayer extends Layer { if (tile) tiles.push(tile); } + //@interlal _checkAndAddTile( frustumMatrix: Matrix4, renderer: any, @@ -1312,6 +1344,7 @@ class TileLayer extends Layer { return tileInfo; } + //@interlal _getTileOffset(...params: number[]): TileOffsetType { // offset result can't be cached, as it varies with map's center. let offset = this.options['offset']; @@ -1328,12 +1361,14 @@ class TileLayer extends Layer { return this._getTileId(x, y, zoom, id); } + //@interlal _getTileId(x: number, y: number, zoom: number, id?: string): string { //id is to mark GroupTileLayer's child layers return `${id || this.getId()}_${x}_${y}_${zoom}`; } + //@interlal _project(pcoord: Coordinate, out: Point) { if (this._hasOwnSR) { const map = this.getMap(); @@ -1345,6 +1380,7 @@ class TileLayer extends Layer { } } + //@interlal _unproject(pcoord: Coordinate, out: Point) { if (this._hasOwnSR) { const map = this.getMap(); @@ -1361,6 +1397,7 @@ class TileLayer extends Layer { * initialize [tileConfig]{@link TileConfig} for the tilelayer * @private */ + //@interlal _initTileConfig() { const map = this.getMap(), tileSize = this.getTileSize(); @@ -1388,12 +1425,15 @@ class TileLayer extends Layer { delete this._disablePyramid; } + //@interlal _getTileConfig(): TileConfig { if (!this._defaultTileConfig) { this._initTileConfig(); } return this._tileConfig || this._defaultTileConfig; } + + //@interlal // eslint-disable-next-line @typescript-eslint/no-unused-vars _bindMap(args?: any) { this._onSpatialReferenceChange(); @@ -1401,6 +1441,7 @@ class TileLayer extends Layer { return super._bindMap.apply(this, arguments); } + //@interlal _isTileInExtent(frustumMatrix: Matrix4, tileExtent: PointExtent, offset: TileOffsetType, glScale: number) { const map = this.getMap(); @@ -1423,6 +1464,7 @@ class TileLayer extends Layer { return intersectsBox(matrix, TILE_BOX); } + //@interlal _isSplittedTileInExtent(frustumMatrix: any, tileExtent: PointExtent, offset: TileOffsetType, glScale: number): boolean { const map = this.getMap(); TILE_BOX[0][0] = (tileExtent.xmin - offset[0]) * glScale; @@ -1438,6 +1480,7 @@ class TileLayer extends Layer { }; } + //@interlal _onSpatialReferenceChange() { delete this._tileConfig; delete this._defaultTileConfig; @@ -1484,6 +1527,7 @@ class TileLayer extends Layer { return super.getRenderer() as TileLayerCanvasRenderer; } + //@interlal _getTileBBox(tile: TileNodeType): BBOX | null { const map = this.getMap(); if (!map) { @@ -1505,6 +1549,7 @@ class TileLayer extends Layer { } + //@interlal _tileInMask(tile: TileNodeType): boolean { const mask = this.getMask(); if (!mask) { diff --git a/src/layer/tile/WMSTileLayer.ts b/src/layer/tile/WMSTileLayer.ts index 88251fc820..39d9e2b1fb 100644 --- a/src/layer/tile/WMSTileLayer.ts +++ b/src/layer/tile/WMSTileLayer.ts @@ -10,8 +10,8 @@ import TileLayer, { TileLayerOptionsType } from './TileLayer'; * @property options.layers - Comma-separated list of WMS layers to show. * @property [options.styles=''] - Comma-separated list of WMS styles. * @property [options.format=image/jpeg] - WMS image format (use `'image/png'` for layers with transparency). - * @property [options.transparent=false] - Is the tile transparent - * @property [options.version=1.1.1] - Version of the WMS service to use + * @property [options.transparent=false] - Is the tile transparent + * @property [options.version=1.1.1] - Version of the WMS service to use * @property [options.crs=null] - Coordinate Reference System to use for the WMS requests, defaults to map CRS. Don't change this if you're not sure what it means. * @property [options.uppercase=false] - If `true`, WMS request parameter keys will be uppercase. * @property [options.detectRetina=false] - If `true` and user is on a retina display, it will request four tiles of half the specified size and a bigger zoom level in place of one to utilize the high resolution. @@ -59,7 +59,8 @@ let wmsExcludeParams: WMSTileLayerOptionsType; class WMSTileLayer extends TileLayer { wmsParams: WMSTileLayerOptionsType; options: WMSTileLayerOptionsType; - private _wmsVersion: number; + //@interlal + _wmsVersion: number; constructor(id: string, options: WMSTileLayerOptionsType) { super(id); @@ -75,6 +76,7 @@ class WMSTileLayer extends TileLayer { } //in Hook,Reset wmsParams + //@interlal _optionsHook(options = {}) { for (const p in options) { //clear tilesize cache diff --git a/src/layer/tile/tileinfo/TileConfig.ts b/src/layer/tile/tileinfo/TileConfig.ts index b275a0a94c..186902950c 100644 --- a/src/layer/tile/tileinfo/TileConfig.ts +++ b/src/layer/tile/tileinfo/TileConfig.ts @@ -18,13 +18,18 @@ class TileConfig { map: Map; tileSize: Size; fullExtent: Extent; - private _xScale: number; - private _yScale: number; - private _pointOrigin: Point; - private _glRes: number; + //@interlal + _xScale: number; + //@interlal + _yScale: number; + //@interlal + _pointOrigin: Point; + //@interlal + _glRes: number; tileSystem: TileSystem; transformation: Transformation; - private _tileFullIndex: Record; + //@interlal + _tileFullIndex: Record; /** * @param tileSystem - tileSystem @@ -69,6 +74,7 @@ class TileConfig { * @param res - current resolution * @return tile index */ + //@interlal _getTileNum(point: Point, res: number): { x: number, y: number } { const tileSystem = this.tileSystem, tileSize = this['tileSize'], @@ -182,6 +188,7 @@ class TileConfig { }; } + //@interlal _getTileFullIndex(res: number) { if (!this._tileFullIndex) { this._tileFullIndex = {}; @@ -296,4 +303,4 @@ type TileIndex = { idx: number; idy: number; out: any; -} \ No newline at end of file +} diff --git a/src/map/Map.Anim.ts b/src/map/Map.Anim.ts index 9229fbd2b6..904397c54b 100644 --- a/src/map/Map.Anim.ts +++ b/src/map/Map.Anim.ts @@ -7,10 +7,13 @@ import { isNil, isFunction, hasOwn, extend, clamp } from '../core/util'; declare module "./Map" { interface Map { - _mapAnimPlayer: Player; + //@interlal + _mapAnimPlayer: Player; isRotating(): boolean; - _animateTo(view: MapViewType, options?: MapAnimationOptionsType, step?: (frame) => void): Player; - _stopAnim(player?: Player): void; + //@interlal + _animateTo(view: MapViewType, options?: MapAnimationOptionsType, step?: (frame) => void): Player; + //@interlal + _stopAnim(player?: Player): void; animateTo(view: MapViewType, options?: MapAnimationOptionsType, step?: (frame) => void): Player; flyTo(view: MapViewType, options?: MapAnimationOptionsType, step?: (frame) => void): this; isAnimating(): boolean; @@ -183,6 +186,7 @@ Map.include(/** @lends Map.prototype */{ return player; }, + //@interlal _animateTo(view, options = {}, step) { if (this._mapAnimPlayer) { this._stopAnim(this._mapAnimPlayer); @@ -422,6 +426,7 @@ Map.include(/** @lends Map.prototype */{ return this.isDragRotating() || !!this._animRotating; }, + //@interlal _endAnim(player, props, zoomOrigin, options) { delete this._animRotating; /** @@ -489,6 +494,7 @@ Map.include(/** @lends Map.prototype */{ } }, + //@interlal _startAnim(props, zoomOrigin) { if (!this._animPlayer) { return; @@ -514,6 +520,7 @@ Map.include(/** @lends Map.prototype */{ this._animPlayer.play(); }, + //@interlal _stopAnim(player) { if (!player) { return; @@ -532,6 +539,7 @@ Map.include(/** @lends Map.prototype */{ // this._resumePrev(player); }, + //@interlal _resumePrev(player) { if (!this._prevAnimPlayer) { return; diff --git a/src/map/Map.Camera.ts b/src/map/Map.Camera.ts index a24aeff676..3f19ba63e6 100644 --- a/src/map/Map.Camera.ts +++ b/src/map/Map.Camera.ts @@ -17,13 +17,18 @@ declare module "./Map" { setFov(fov: number): this; getBearing(): number; setBearing(bearing: number): this; - _setBearing(bearing: number): this; + //@interlal + _setBearing(bearing: number): this; getPitch(): number; setPitch(pitch: number): this; - _setPitch(pitch: number): this; - _calcMatrices(): void; - _containerPointToPoint(p: Point, zoom?: number, out?: Point): Point; - _recenterOnTerrain(): void; + //@interlal + _setPitch(pitch: number): this; + //@interlal + _calcMatrices(): void; + //@interlal + _containerPointToPoint(p: Point, zoom?: number, out?: Point): Point; + //@interlal + _recenterOnTerrain(): void; setCameraMovements(frameOptions: Array, option?: { autoRotate: boolean }); setCameraOrientation(params: MapViewType): this; setCameraPosition(coordinate: Coordinate); @@ -32,12 +37,18 @@ declare module "./Map" { isTransforming(): boolean; getFrustumAltitude(): number; updateCenterAltitude(); - _queryTerrainByProjCoord(coord: Coordinate): number; - _hasAltitudeLayer(): boolean; - _queryTerrainInfo(containerPoint: Point): { coordinate: Coordinate, altitude: number } | null; - _pointAtResToContainerPoint(point: Point, res?: number, altitude?: number, out?: Point): Point; - _pointToContainerPoint(point: Point, zoom?: number, out?: Point): Point; - _pointsAtResToContainerPoints(point: Point[], res?: number, altitude?: number[], out?: Point[]): Point[]; + //@interlal + _queryTerrainByProjCoord(coord: Coordinate): number; + //@interlal + _hasAltitudeLayer(): boolean; + //@interlal + _queryTerrainInfo(containerPoint: Point): { coordinate: Coordinate, altitude: number } | null; + //@interlal + _pointAtResToContainerPoint(point: Point, res?: number, altitude?: number, out?: Point): Point; + //@interlal + _pointToContainerPoint(point: Point, zoom?: number, out?: Point): Point; + //@interlal + _pointsAtResToContainerPoints(point: Point[], res?: number, altitude?: number[], out?: Point[]): Point[]; } } @@ -134,6 +145,7 @@ Map.include(/** @lends Map.prototype */{ return this._setBearing(view.bearing); }, + //@interlal _setBearing(bearing) { if (Browser.ie9) { throw new Error('map can\'t rotate in IE9.'); @@ -203,6 +215,7 @@ Map.include(/** @lends Map.prototype */{ return this._setPitch(view.pitch); }, + //@interlal _setPitch(pitch) { if (Browser.ie9) { throw new Error('map can\'t tilt in IE9.'); @@ -311,6 +324,7 @@ Map.include(/** @lends Map.prototype */{ }; }, + //@interlal _setCameraMovement(frameOption, frame) { this.animateTo({ zoom: frameOption.zoom, @@ -435,6 +449,7 @@ Map.include(/** @lends Map.prototype */{ return this._frustumAltitude; }, + //@interlal _calcFrustumAltitude() { const pitch = 90 - this.getPitch(); let fov = this.getFov() / 2; @@ -458,11 +473,13 @@ Map.include(/** @lends Map.prototype */{ * @private * @function */ + //@interlal _pointToContainerPoint: function (point, zoom, altitude = 0, out) { const res = this._getResolution(zoom); return this._pointAtResToContainerPoint(point, res, altitude, out); }, + //@interlal _pointAtResToContainerPoint: function (point, res, altitude = 0, out) { if (!out) { out = new Point(0, 0); @@ -481,6 +498,7 @@ Map.include(/** @lends Map.prototype */{ /** *Batch conversion for better performance */ + //@interlal _pointsAtResToContainerPoints: function (points, targetRes, altitudes = [], resultPoints = []) { const pitch = this.getPitch(), bearing = this.getBearing(); const scale = targetRes / this._getResolution(); @@ -523,6 +541,7 @@ Map.include(/** @lends Map.prototype */{ return resultPoints; }, + //@interlal _toContainerPoint: function () { const a = [0, 0, 0]; return function (out, isTransforming, altitude, centerPoint) { @@ -546,6 +565,7 @@ Map.include(/** @lends Map.prototype */{ }(), // https://forum.unity.com/threads/camera-worldtoscreenpoint-bug.85311/#post-2121212 + //@interlal _projIfBehindCamera: function () { const vectorFromCam = new Array(3); const proj = new Array(3); @@ -570,11 +590,13 @@ Map.include(/** @lends Map.prototype */{ * @private * @function */ + //@interlal _containerPointToPoint: function (p, zoom, out, height) { const res = this._getResolution(zoom); return this._containerPointToPointAtRes(p, res, out, height); }, + //@interlal _containerPointToPointAtRes: function () { const cp = [0, 0, 0], coord0 = [0, 0, 0, 1], @@ -633,6 +655,7 @@ Map.include(/** @lends Map.prototype */{ * map.projViewMatrixInverse = projViewMatrix.inverse() * @private */ + //@interlal _calcMatrices: function () { // closure matrixes to reuse const m1 = createMat4(); @@ -679,6 +702,7 @@ Map.include(/** @lends Map.prototype */{ }; }(), + //@interlal _getCameraFar(fov, pitch) { const cameraCenterDistance = this.cameraCenterDistance = distance(this.cameraPosition, this.cameraLookAt); const distanceInMeter = cameraCenterDistance / this._meterToGLPoint; @@ -687,6 +711,7 @@ Map.include(/** @lends Map.prototype */{ return Math.max(cameraFarDistance * this._meterToGLPoint, cameraCenterDistance * 5); }, + //@interlal _calcCascadeMatrixes: function () { // const cameraLookAt = []; // const cameraPosition = []; @@ -738,6 +763,7 @@ Map.include(/** @lends Map.prototype */{ }; }(), + //@interlal _calcDomMatrix: function () { const m = createMat4(), m1 = createMat4(), @@ -761,12 +787,14 @@ Map.include(/** @lends Map.prototype */{ }; }(), + //@interlal _getFovZ(zoom) { const scale = this.getGLScale(zoom); const ratio = this._getFovRatio(); return scale * (this.height || 1) / 2 / ratio; }, + //@interlal _getCameraWorldMatrix: function () { const q = {}; return function () { @@ -841,6 +869,7 @@ Map.include(/** @lends Map.prototype */{ this._recenterOnTerrain(); }, + //@interlal _recenterOnTerrain() { if (this.centerAltitude === undefined || this._centerZ !== undefined) { return; @@ -918,6 +947,7 @@ Map.include(/** @lends Map.prototype */{ // return zoom; // }, + //@interlal _queryTerrainByProjCoord(coord) { const layers = this._getLayers(); for (let i = 0; i < layers.length; i++) { @@ -928,6 +958,7 @@ Map.include(/** @lends Map.prototype */{ return 0; }, + //@interlal _hasAltitudeLayer() { const layers = this._getLayers(); for (let i = 0; i < layers.length; i++) { @@ -938,6 +969,7 @@ Map.include(/** @lends Map.prototype */{ return false; }, + //@interlal _queryTerrainInfo(containerPoint) { const layers = this._getLayers() || []; for (let i = 0; i < layers.length; i++) { @@ -957,11 +989,13 @@ Map.include(/** @lends Map.prototype */{ return null; }, + //@interlal _getFovRatio() { const fov = this.getFov(); return Math.tan(fov / 2 * RADIAN); }, + //@interlal _renderLayers() { if (this.isInteracting()) { return; diff --git a/src/map/Map.Collision.ts b/src/map/Map.Collision.ts index 4df81953ba..70044cc815 100644 --- a/src/map/Map.Collision.ts +++ b/src/map/Map.Collision.ts @@ -7,10 +7,13 @@ declare module "./Map" { getCollisionIndex(): CollisionIndex createCollisionIndex(): CollisionIndex clearCollisionIndex(): this - _insertUICollidesQueue(): this + //@interlal + _insertUICollidesQueue(): this uiCollides(): this - _addUI(ui: UIComponent): this - _removeUI(ui: UIComponent): number + //@interlal + _addUI(ui: UIComponent): this + //@interlal + _removeUI(ui: UIComponent): number } } @@ -56,6 +59,7 @@ Map.include({ return this; }, + //@interlal _insertUICollidesQueue(): Map { if (!this._uiCollidesQueue) { this._uiCollidesQueue = []; @@ -123,6 +127,7 @@ Map.include({ * @private * @param ui - UIComponent对象 */ + //@interlal _addUI(ui: UIComponent): Map { if (!this.uiList) { this.uiList = []; @@ -143,6 +148,7 @@ Map.include({ * @private * @param ui - UIComponent对象 */ + //@interlal _removeUI(ui: UIComponent): number { if (!this.uiList) { return -1; diff --git a/src/map/Map.CoordTransform.ts b/src/map/Map.CoordTransform.ts index f6ebb59cfb..0c2e354fe8 100644 --- a/src/map/Map.CoordTransform.ts +++ b/src/map/Map.CoordTransform.ts @@ -445,6 +445,7 @@ Map.include(/** @lends Map.prototype */{ }; }(), + //@interlal _get2DExtent(zoom, out) { let cached; if ((zoom === undefined || zoom === this._zoomLevel) && this._mapExtent2D) { @@ -465,6 +466,7 @@ Map.include(/** @lends Map.prototype */{ return this._get2DExtent(zoom, out); }, + //@interlal _get2DExtentAtRes: function () { const POINT = new Point(0, 0); return function (res, out) { @@ -484,6 +486,7 @@ Map.include(/** @lends Map.prototype */{ return this._pointToExtent(extent2D); }, + //@interlal _pointToExtent: function () { const COORD0 = new Coordinate(0, 0); const COORD1 = new Coordinate(0, 0); @@ -519,6 +522,7 @@ Map.include(/** @lends Map.prototype */{ }; }(), + //@interlal _viewPointToPrj: function () { const POINT = new Point(0, 0); return function (viewPoint, out) { @@ -530,6 +534,7 @@ Map.include(/** @lends Map.prototype */{ return this._viewPointToPrj(viewPoint, out); }, + //@interlal _prjToContainerPoint(pCoordinate, zoom, out, altitude) { const res = this._getResolution(zoom); return this._prjToContainerPointAtRes(pCoordinate, res, out, altitude); @@ -539,6 +544,7 @@ Map.include(/** @lends Map.prototype */{ return this._prjToContainerPoint(pCoordinate, zoom, out, altitude); }, + //@interlal _prjToContainerPointAtRes: function () { const POINT = new Point(0, 0); return function (pCoordinate, res, out, altitude) { @@ -550,6 +556,7 @@ Map.include(/** @lends Map.prototype */{ return this.prjToContainerPointAtRes(pCoordinate, res, out, altitude); }, + //@interlal _prjToViewPoint: function () { const POINT = new Point(0, 0); return function (pCoordinate, out, altitude) { @@ -562,6 +569,7 @@ Map.include(/** @lends Map.prototype */{ return this._prjToViewPoint(pCoordinate, out, altitude); }, + //@interlal _viewPointToPoint: function () { const POINT = new Point(0, 0); return function (viewPoint, zoom, out) { @@ -573,6 +581,7 @@ Map.include(/** @lends Map.prototype */{ return this._viewPointToPoint(viewPoint, zoom, out); }, + //@interlal _pointToViewPoint: function () { const COORD = new Coordinate(0, 0); return function (point, zoom, out) { diff --git a/src/map/Map.DomEvents.ts b/src/map/Map.DomEvents.ts index 3fdf7b59a2..b5d56526a6 100644 --- a/src/map/Map.DomEvents.ts +++ b/src/map/Map.DomEvents.ts @@ -13,13 +13,20 @@ import { Coordinate, Point } from '../geo'; declare module "./Map" { interface Map { - _removeDomEvents(): void; - _ignoreEvent(domEvent: MapEventDomType): boolean; - _isEventOutMap(domEvent: MapEventDomType): boolean; - _parseEvent(e: MapEventDomType, type?: string): MapEventDataType; - _parseEventFromCoord(coord: Coordinate): MapEventDataType; - _fireDOMEvent(target: any, e: MapEventDomType, type: string); - _getEventParams(e: MapEventDomType): MapEventDataType; + //@interlal + _removeDomEvents(): void; + //@interlal + _ignoreEvent(domEvent: MapEventDomType): boolean; + //@interlal + _isEventOutMap(domEvent: MapEventDomType): boolean; + //@interlal + _parseEvent(e: MapEventDomType, type?: string): MapEventDataType; + //@interlal + _parseEventFromCoord(coord: Coordinate): MapEventDataType; + //@interlal + _fireDOMEvent(target: any, e: MapEventDomType, type: string); + //@interlal + _getEventParams(e: MapEventDomType): MapEventDataType; } } @@ -225,18 +232,21 @@ const events = 'drop '; Map.include(/** @lends Map.prototype */ { + //@interlal _registerDomEvents() { const dom = this._panels.mapWrapper || this._containerDOM; addDomEvent(dom, events, this._handleDOMEvent, this); addDomEvent(dom, DRAGEVENTS, dragEventHanlder, this); }, + //@interlal _removeDomEvents() { const dom = this._panels.mapWrapper || this._containerDOM; removeDomEvent(dom, events, this._handleDOMEvent); removeDomEvent(dom, DRAGEVENTS, dragEventHanlder); }, + //@interlal _handleDOMEvent(e: MapEventDomType) { if (e && e.type === 'drop') { // https://developer.mozilla.org/zh-CN/docs/Web/API/HTML_Drag_and_Drop_API @@ -321,6 +331,7 @@ Map.include(/** @lends Map.prototype */ { } }, + //@interlal _ignoreEvent(domEvent) { //ignore events originated from control and ui doms. if (!domEvent || !this._panels.control) { @@ -345,6 +356,7 @@ Map.include(/** @lends Map.prototype */ { return false; }, + //@interlal _isEventOutMap(domEvent: MapEventDomType) { if (this.getPitch() > this.options['maxVisualPitch']) { const actualEvent = this._getActualEvent(domEvent); @@ -356,12 +368,14 @@ Map.include(/** @lends Map.prototype */ { return false; }, + //@interlal _wrapTerrainData(eventParam: MapEventDataType) { if (eventParam.containerPoint && !eventParam.terrain) { eventParam.terrain = this._queryTerrainInfo(eventParam.containerPoint); } }, + //@interlal _parseEvent(e: MapEventDomType, type: string): MapEventDataType { if (!e) { return null; @@ -391,6 +405,7 @@ Map.include(/** @lends Map.prototype */ { return eventParam; }, + //@interlal _parseEventFromCoord(coord: Coordinate): MapEventDataType { const containerPoint = this.coordToContainerPoint(coord), viewPoint = this.containerPointToViewPoint(containerPoint); @@ -403,6 +418,7 @@ Map.include(/** @lends Map.prototype */ { return e; }, + //@interlal _getActualEvent(e: MapEventDomType) { e = e as TouchEvent; return e.touches && e.touches.length > 0 ? @@ -410,6 +426,7 @@ Map.include(/** @lends Map.prototype */ { e.changedTouches[0] : e; }, + //@interlal _fireDOMEvent(target, e: MapEventDomType, type: string) { if (this.isRemoved()) { return; @@ -439,6 +456,7 @@ Map.include(/** @lends Map.prototype */ { // } // Extract _ geteventparams is reused in other plug-ins,such as maptalks.three plugin + //@interlal _getEventParams(e): MapEventDataType { const map = this; const eventParam = { diff --git a/src/map/Map.FullScreen.ts b/src/map/Map.FullScreen.ts index c9a019d178..6168a35d0a 100644 --- a/src/map/Map.FullScreen.ts +++ b/src/map/Map.FullScreen.ts @@ -5,8 +5,10 @@ declare module "./Map" { isFullScreen(): boolean; requestFullScreen(dom?: HTMLDivElement): this; cancelFullScreen(): this; - _requestFullScreen(dom: HTMLDivElement): void; - _cancelFullScreen(): void; + //@interlal + _requestFullScreen(dom: HTMLDivElement): void; + //@interlal + _cancelFullScreen(): void; } } @@ -70,6 +72,7 @@ Map.include(/** @lends Map.prototype */ { return this; }, + //@interlal _requestFullScreen(dom) { if (dom.requestFullscreen) { dom.requestFullscreen(); @@ -92,6 +95,7 @@ Map.include(/** @lends Map.prototype */ { } }, + //@interlal _cancelFullScreen() { const doc=document as any; if (document.exitFullscreen) { diff --git a/src/map/Map.Pan.ts b/src/map/Map.Pan.ts index 7a82146576..918fcafc0b 100644 --- a/src/map/Map.Pan.ts +++ b/src/map/Map.Pan.ts @@ -9,9 +9,11 @@ declare module "./Map" { interface Map { panTo(coordinate: Coordinate, options?: MapAnimationOptionsType, step?: (frame) => void): this; - _panTo(prjCoord: Coordinate, options?: MapAnimationOptionsType): this; + //@interlal + _panTo(prjCoord: Coordinate, options?: MapAnimationOptionsType): this; panBy(offset: Point | Array, options?: MapAnimationOptionsType, step?: (frame) => void): this; - _panAnimation(target: Coordinate, t?: number, cb?: (frame) => void): void; + //@interlal + _panAnimation(target: Coordinate, t?: number, cb?: (frame) => void): void; } } @@ -45,6 +47,7 @@ Map.include(/** @lends Map.prototype */ { return this; }, + //@interlal _panTo: function (prjCoord, options: MapAnimationOptionsType = {}) { if (typeof (options['animation']) === 'undefined' || options['animation']) { return this._panAnimation(prjCoord, options['duration']); @@ -101,6 +104,7 @@ Map.include(/** @lends Map.prototype */ { return this; }, + //@interlal _panAnimation: function (target: Coordinate, t: number, cb: (frame) => void) { return this._animateTo({ 'prjCenter': target diff --git a/src/map/Map.Topo.ts b/src/map/Map.Topo.ts index afd20d6075..ceb62e8a1b 100644 --- a/src/map/Map.Topo.ts +++ b/src/map/Map.Topo.ts @@ -165,6 +165,7 @@ Map.include(/** @lends Map.prototype */ { }); }, + //@interlal _identify: function (opts, callback, fn) { const reqLayers = opts['layers']; if (!isArrayHasData(reqLayers)) { diff --git a/src/map/Map.ViewHistory.ts b/src/map/Map.ViewHistory.ts index 5b8f461937..0bae2397df 100644 --- a/src/map/Map.ViewHistory.ts +++ b/src/map/Map.ViewHistory.ts @@ -3,14 +3,17 @@ import Map, { MapAnimationOptionsType, MapViewType } from './Map'; declare module "./Map" { interface Map { - _viewHistory: Array; + //@interlal + _viewHistory: Array; zoomToPreviousView(options?: any): MapViewType; hasPreviousView(): boolean; zoomToNextView(options?: any): MapViewType; hasNextView(): boolean; getViewHistory(): Array; - _onViewChange(view: MapViewType): void; - _getCurrentView(): MapViewType; + //@interlal + _onViewChange(view: MapViewType): void; + //@interlal + _getCurrentView(): MapViewType; } @@ -19,6 +22,7 @@ declare module "./Map" { Map.include(/** @lends Map.prototype */ { + //@interlal _onViewChange(view: MapViewType) { if (!this._viewHistory) { this._viewHistory = []; @@ -104,6 +108,7 @@ Map.include(/** @lends Map.prototype */ { return true; }, + //@interlal _zoomToView(view: MapViewType, options: MapAnimationOptionsType) { const old = this.getView(); if (options['animation']) { @@ -128,6 +133,7 @@ Map.include(/** @lends Map.prototype */ { return this._viewHistory; }, + //@interlal _fireViewChange(old: MapViewType, view: MapViewType) { this._fireEvent('viewchange', { 'old': old, @@ -136,6 +142,7 @@ Map.include(/** @lends Map.prototype */ { this._insertUICollidesQueue(); }, + //@interlal _getCurrentView(): MapViewType { if (!this._viewHistory) { return null; diff --git a/src/map/Map.Zoom.ts b/src/map/Map.Zoom.ts index 4df880b68d..0cf1a3302f 100644 --- a/src/map/Map.Zoom.ts +++ b/src/map/Map.Zoom.ts @@ -6,15 +6,21 @@ import Map from './Map'; declare module "./Map" { interface Map { - _zoom(nextZoom: number, origin?: Point); - _zoomAnimation(nextZoom: number, origin?: Point, startScale?: number); - _checkZoomOrigin(origin?: Point): Point; - _startZoomAnim(nextZoom: number, origin?: Point, startScale?: number); + //@interlal + _zoom(nextZoom: number, origin?: Point); + //@interlal + _zoomAnimation(nextZoom: number, origin?: Point, startScale?: number); + //@interlal + _checkZoomOrigin(origin?: Point): Point; + //@interlal + _startZoomAnim(nextZoom: number, origin?: Point, startScale?: number); onZoomStart(nextZoom: number, origin?: Point); onZooming(nextZoom: number, origin?: Point, startScale?: number); onZoomEnd(nextZoom: number, origin?: Point); - _zoomTo(nextZoom: number, origin?: Point); - _checkZoom(nextZoom: number): number; + //@interlal + _zoomTo(nextZoom: number, origin?: Point); + //@interlal + _checkZoom(nextZoom: number): number; } } @@ -22,6 +28,7 @@ declare module "./Map" { Map.include(/** @lends Map.prototype */{ + //@interlal _zoom(nextZoom: number, origin?: Point) { if (!this.options['zoomable'] || this.isZooming()) { return; } origin = this._checkZoomOrigin(origin); @@ -31,6 +38,7 @@ Map.include(/** @lends Map.prototype */{ this.onZoomEnd(nextZoom, origin); }, + //@interlal _zoomAnimation(nextZoom: number, origin?: Point, startScale?: number) { if (!this.options['zoomable'] || this.isZooming()) { return; } @@ -42,6 +50,7 @@ Map.include(/** @lends Map.prototype */{ this._startZoomAnim(nextZoom, origin, startScale); }, + //@interlal _checkZoomOrigin(origin?: Point) { if (!origin || this.options['zoomInCenter']) { origin = new Point(this.width / 2, this.height / 2); @@ -52,6 +61,7 @@ Map.include(/** @lends Map.prototype */{ return origin; }, + //@interlal _startZoomAnim(nextZoom: number, origin?: Point, startScale?: number) { if (isNil(startScale)) { startScale = 1; @@ -159,6 +169,7 @@ Map.include(/** @lends Map.prototype */{ } }, + //@interlal _zoomTo(nextZoom: number, origin?: Point) { this._zoomLevel = nextZoom; this._calcMatrices(); @@ -169,6 +180,7 @@ Map.include(/** @lends Map.prototype */{ } }, + //@interlal _checkZoom(nextZoom: number) { const maxZoom = this.getMaxZoom(), minZoom = this.getMinZoom(); diff --git a/src/map/Map.ts b/src/map/Map.ts index 28c4d1acfc..980597a5c7 100644 --- a/src/map/Map.ts +++ b/src/map/Map.ts @@ -188,44 +188,76 @@ const options: MapOptionsType = { */ export class Map extends Handlerable(Eventable(Renderable(Class))) { VERSION: string; - private _loaded: boolean; - private _panels: Record; - private _baseLayer: Layer; - private _layers: Array; - private _zoomLevel: number; - private _center: Coordinate; - private _centerZ: number; - private _mapViewPoint: Point; + //@interlal + _loaded: boolean; + //@interlal + _panels: Record; + //@interlal + _baseLayer: Layer; + //@interlal + _layers: Array; + //@interlal + _zoomLevel: number; + //@interlal + _center: Coordinate; + //@interlal + _centerZ: number; + //@interlal + _mapViewPoint: Point; isMap: boolean; - private _containerDOM: HTMLDivElement | HTMLCanvasElement; - private _spatialReference: SpatialReference; - private _originLng: number; - private _altitudeOriginDirty: boolean; - private _glScale: number; - private _cursor: string; - private _prjCenter: Coordinate; - private centerAltitude: number; + //@interlal + _containerDOM: HTMLDivElement | HTMLCanvasElement; + //@interlal + _spatialReference: SpatialReference; + //@interlal + _originLng: number; + //@interlal + _altitudeOriginDirty: boolean; + //@interlal + _glScale: number; + //@interlal + _cursor: string; + //@interlal + _prjCenter: Coordinate; + centerAltitude: number; width: number; height: number; - private _prjMaxExtent: PointExtent; - private _glRes: number; - private _zooming: boolean; - private _layerCache: { [key: string]: Layer }; - private _mapViewCoord: Coordinate; - private _eventSilence: boolean; - private _moving: boolean; - private _originCenter: Coordinate; - private _suppressRecenter: boolean; - private _dragRotating: boolean; + //@interlal + _prjMaxExtent: PointExtent; + //@interlal + _glRes: number; + //@interlal + _zooming: boolean; + //@interlal + _layerCache: { [key: string]: Layer }; + //@interlal + _mapViewCoord: Coordinate; + //@interlal + _eventSilence: boolean; + //@interlal + _moving: boolean; + //@interlal + _originCenter: Coordinate; + //@interlal + _suppressRecenter: boolean; + //@interlal + _dragRotating: boolean; CanvasClass: any; - private _priorityCursor: string; - private _initTime: number; - private _renderer: any; - private _containerDomContentRect: DOMRect; - private _mapRes: number; - private _onLoadHooks: Array<(...args) => void>; - private cameraCenterDistance: number; - private _limitMaxExtenting: boolean; + //@interlal + _priorityCursor: string; + //@interlal + _initTime: number; + //@interlal + _renderer: any; + //@interlal + _containerDomContentRect: DOMRect; + //@interlal + _mapRes: number; + //@interlal + _onLoadHooks: Array<(...args) => void>; + cameraCenterDistance: number; + //@interlal + _limitMaxExtenting: boolean; options: MapOptionsType; static VERSION: string; JSON_VERSION: '1.0'; @@ -395,6 +427,7 @@ export class Map extends Handlerable(Eventable(Renderable(Class))) { return this; } + //@interlal _updateSpatialReference(ref: SpatialReferenceType, oldRef) { if (isString(ref)) { ref = SpatialReference.getPreset(ref); @@ -606,6 +639,7 @@ export class Map extends Handlerable(Eventable(Renderable(Class))) { return new PointExtent(0, this.height - visualHeight, this.width, this.height); } + //@interlal _getVisualHeight(visualPitch) { // const pitch = this.getPitch(); // const visualDistance = this.height / 2 * Math.tan(visualPitch * Math.PI / 180); @@ -941,6 +975,7 @@ export class Map extends Handlerable(Eventable(Renderable(Class))) { * @param {Number} [options.paddingBottom] - Sets the amount of padding in the bottom of a map container * @returns {Object|null} */ + //@interlal _getPaddingSize(options = {}) { if (options['paddingLeft'] || options['paddingTop'] || options['paddingRight'] || options['paddingBottom']) { return { @@ -1002,6 +1037,7 @@ export class Map extends Handlerable(Eventable(Renderable(Class))) { }; } + //@interlal _validateView(view: MapViewType) { if (!view || !isObject(view)) { return; @@ -1080,6 +1116,7 @@ export class Map extends Handlerable(Eventable(Renderable(Class))) { * @param {Number} [padding.paddingBottom] - Sets the amount of padding in the bottom of a map container * @return {Coordinate} */ + //@interlal _getCenterByPadding(center: Coordinate, zoom?: number, padding?: MapPaddingType) { const point = this.coordinateToPoint(center, zoom); const { paddingLeft = 0, paddingRight = 0, paddingTop = 0, paddingBottom = 0 } = padding || {}; @@ -1880,6 +1917,7 @@ export class Map extends Handlerable(Eventable(Renderable(Class))) { //----------------------------------------------------------- + //@interlal _initContainer(container: MapContainerType) { if (isString(container)) { this._containerDOM = document.getElementById(container) as HTMLDivElement; @@ -1907,6 +1945,7 @@ export class Map extends Handlerable(Eventable(Renderable(Class))) { * @private * @param {String} cursor css cursor */ + //@interlal _trySetCursor(cursor: string) { if (!this._cursor && !this._priorityCursor) { if (!cursor) { @@ -1917,6 +1956,7 @@ export class Map extends Handlerable(Eventable(Renderable(Class))) { return this; } + //@interlal _setPriorityCursor(cursor: string) { if (!cursor) { let hasCursor = false; @@ -1934,6 +1974,7 @@ export class Map extends Handlerable(Eventable(Renderable(Class))) { return this; } + //@interlal _setCursorToPanel(cursor: string) { const panel = this.getMainPanel(); if (panel && panel.style && panel.style.cursor !== cursor) { @@ -1943,6 +1984,7 @@ export class Map extends Handlerable(Eventable(Renderable(Class))) { //remove a layer from the layerList + //@interlal _removeLayer(layer: Layer, layerList: Array) { if (!layer || !layerList) { return; @@ -1953,6 +1995,7 @@ export class Map extends Handlerable(Eventable(Renderable(Class))) { } } + //@interlal _sortLayersByZIndex() { if (!this._layers) { return; @@ -1976,6 +2019,7 @@ export class Map extends Handlerable(Eventable(Renderable(Class))) { } + //@interlal _fireEvent(eventName: string, param?: { [key: string]: any }) { if (this._eventSilence) { return; @@ -1988,6 +2032,7 @@ export class Map extends Handlerable(Eventable(Renderable(Class))) { this.fire(eventName, param); } + //@interlal _Load() { this._resetMapStatus(); if (this.options['pitch']) { @@ -2006,6 +2051,7 @@ export class Map extends Handlerable(Eventable(Renderable(Class))) { this._initTime = now(); } + //@interlal _initRenderer() { const renderer = this.options['renderer']; const clazz = Map.getRendererClass(renderer) as any; @@ -2013,10 +2059,12 @@ export class Map extends Handlerable(Eventable(Renderable(Class))) { this._renderer.load(); } + //@interlal _getRenderer() { return this._renderer; } + //@interlal _loadAllLayers() { function loadLayer(layer) { if (layer) { @@ -2035,6 +2083,7 @@ export class Map extends Handlerable(Eventable(Renderable(Class))) { * @return {Layer[]} * @private */ + //@interlal _getLayers(filter?: (layer: Layer) => boolean) { const layers = this._baseLayer ? [this._baseLayer].concat(this._layers) : this._layers; const result = []; @@ -2046,6 +2095,7 @@ export class Map extends Handlerable(Eventable(Renderable(Class))) { return result; } + //@interlal _eachLayer(fn, ...layerLists) { if (arguments.length < 2) { return; @@ -2063,6 +2113,7 @@ export class Map extends Handlerable(Eventable(Renderable(Class))) { } } + //@interlal _onLayerEvent(param) { if (!param) { return; @@ -2074,6 +2125,7 @@ export class Map extends Handlerable(Eventable(Renderable(Class))) { } //Check and reset map's status when map's spatial reference is changed. + //@interlal _resetMapStatus() { let maxZoom = this.getMaxZoom(), minZoom = this.getMinZoom(); @@ -2112,6 +2164,7 @@ export class Map extends Handlerable(Eventable(Renderable(Class))) { this._containerDomContentRect = domRect; } + //@interlal _getContainerDomSize(): Size | null { if (!this._containerDOM) { return null; @@ -2143,6 +2196,7 @@ export class Map extends Handlerable(Eventable(Renderable(Class))) { return new Size(width, height); } + //@interlal _updateMapSize(mSize: Size) { this.width = mSize['width']; this.height = mSize['height']; @@ -2156,10 +2210,12 @@ export class Map extends Handlerable(Eventable(Renderable(Class))) { * @return {Coordinate} * @private */ + //@interlal _getPrjCenter() { return this._prjCenter; } + //@interlal _setPrjCenter(pcenter: Coordinate) { this._prjCenter = pcenter; if (this.isInteracting() && !this.isMoving()) { @@ -2170,6 +2226,7 @@ export class Map extends Handlerable(Eventable(Renderable(Class))) { this._calcMatrices(); } + //@interlal _setPrjCoordAtContainerPoint(coordinate: Coordinate, point: Point) { if (!this.centerAltitude && point.x === this.width / 2 && point.y === this.height / 2) { return this; @@ -2181,12 +2238,14 @@ export class Map extends Handlerable(Eventable(Renderable(Class))) { return this; } + //@interlal _setPrjCoordAtOffsetToCenter(prjCoord: Coordinate, offset: Point) { const pcenter = this._pointToPrj(this._prjToPoint(prjCoord)._sub(offset)); this._setPrjCenter(pcenter); return this; } + //@interlal _verifyExtent(prjCenter: Coordinate) { if (!prjCenter) { return false; @@ -2198,6 +2257,7 @@ export class Map extends Handlerable(Eventable(Renderable(Class))) { return maxExt.contains(prjCenter); } + //@interlal _limitMaxExtent() { if (this._limitMaxExtenting || !this.options.limitExtentOnMaxExtent) { return this; @@ -2294,9 +2354,10 @@ export class Map extends Handlerable(Eventable(Renderable(Class))) { * -1,1 | 1,1 * ------------ *-1,-1 | 1,-1 - * @private + * @ * @returns {Coordinate} the new projected center. */ + //@interlal _offsetCenterByPixel(pixel: Point) { const pos = TEMP_POINT.set(this.width / 2 - pixel.x, this.height / 2 - pixel.y); const coord = this._containerPointToPrj(pos, TEMP_COORD); @@ -2339,6 +2400,7 @@ export class Map extends Handlerable(Eventable(Renderable(Class))) { } + //@interlal _resetMapViewPoint() { this._mapViewPoint = new Point(0, 0); // mapViewCoord is the proj coordinate of current view point @@ -2350,6 +2412,7 @@ export class Map extends Handlerable(Eventable(Renderable(Class))) { * @return {Number} resolution * @private */ + //@interlal _getResolution(zoom?: number) { if ((zoom === undefined || zoom === this._zoomLevel) && this._mapRes !== undefined) { return this._mapRes; @@ -2360,6 +2423,7 @@ export class Map extends Handlerable(Eventable(Renderable(Class))) { return this._spatialReference.getResolution(zoom); } + //@interlal _getResolutions() { return this._spatialReference.getResolutions(); } @@ -2371,12 +2435,14 @@ export class Map extends Handlerable(Eventable(Renderable(Class))) { * @return {Point} 2D point * @private */ + //@interlal _prjToPoint(pCoord, zoom?: number, out?: Point) { zoom = (isNil(zoom) ? this.getZoom() : zoom); const res = this._getResolution(zoom); return this._prjToPointAtRes(pCoord, res, out); } + //@interlal _prjToPointAtRes(pCoord: Coordinate, res?: number, out?: Point): Point { return this._spatialReference.getTransformation().transform(pCoord, res, out); } @@ -2388,6 +2454,7 @@ export class Map extends Handlerable(Eventable(Renderable(Class))) { * @return {Point} 2D point * @private */ + //@interlal _prjsToPointsAtRes(pCoords: Array, res?: number, resultPoints = []): Array { const transformation = this._spatialReference.getTransformation(); const pts = []; @@ -2405,12 +2472,14 @@ export class Map extends Handlerable(Eventable(Renderable(Class))) { * @return {Coordinate} projected coordinate * @private */ + //@interlal _pointToPrj(point: Point, zoom?: number, out?: Coordinate): Coordinate { zoom = (isNil(zoom) ? this.getZoom() : zoom); const res = this._getResolution(zoom); return this._pointToPrjAtRes(point, res, out); } + //@interlal _pointToPrjAtRes(point: Point, res?: number, out?: Coordinate): Coordinate { return this._spatialReference.getTransformation().untransform(point, res, out); } @@ -2422,6 +2491,7 @@ export class Map extends Handlerable(Eventable(Renderable(Class))) { * @return {Point} point at current zoom * @private */ + //@interlal _pointToPoint(point: Point, zoom?: number, out?: Point): Point { if (!isNil(zoom)) { return this._pointAtResToPoint(point, this._getResolution(zoom), out); @@ -2435,6 +2505,7 @@ export class Map extends Handlerable(Eventable(Renderable(Class))) { return out; } + //@interlal _pointAtResToPoint(point: Point, res?: number, out?: Point): Point { if (out) { out.x = point.x; @@ -2452,6 +2523,7 @@ export class Map extends Handlerable(Eventable(Renderable(Class))) { * @return {Point} point at target res * @private */ + //@interlal _pointToPointAtRes(point: Point, res?: number, out?: Point): Point { if (out) { out.x = point.x; @@ -2469,12 +2541,14 @@ export class Map extends Handlerable(Eventable(Renderable(Class))) { * @return {Coordinate} * @private */ + //@interlal _containerPointToPrj(containerPoint: Point, out?: Coordinate) { return this._pointToPrj(this._containerPointToPoint(containerPoint, undefined, out as Point), undefined, out); } /* eslint no-extend-native: 0 */ + //@interlal _callOnLoadHooks() { const proto = Map.prototype; if (!proto._onLoadHooks) { @@ -2485,6 +2559,7 @@ export class Map extends Handlerable(Eventable(Renderable(Class))) { } } //fix prj value when current view is world wide + //@interlal _fixPrjOnWorldWide(prjCoord: Coordinate) { const projection = this.getProjection() as any; if (projection && projection.fullExtent && prjCoord) { diff --git a/src/map/handler/Map.AutoPanAtEdge.ts b/src/map/handler/Map.AutoPanAtEdge.ts index f79ce21512..ba1ed0024f 100644 --- a/src/map/handler/Map.AutoPanAtEdge.ts +++ b/src/map/handler/Map.AutoPanAtEdge.ts @@ -20,6 +20,7 @@ class MapAutoPanAtEdgeHandler extends Handler { this.target.off('_mousemove', this._onMouseMove, this); } + //@interlal _onMouseMove(event: Event) { const map = this.target; if (map.options['autoPanAtEdge']) { diff --git a/src/map/handler/Map.BoxZoom.ts b/src/map/handler/Map.BoxZoom.ts index 5f816e0213..a7f90b8f22 100644 --- a/src/map/handler/Map.BoxZoom.ts +++ b/src/map/handler/Map.BoxZoom.ts @@ -27,6 +27,7 @@ class MapBoxZoomHander extends Handler { } } + //@interlal _onMouseDown(param: Param) { if (!this.target.options['boxZoom']) { return; @@ -38,6 +39,7 @@ class MapBoxZoomHander extends Handler { } } + //@interlal _boxZoom(param: Param) { const map = this.target; this.drawTool.remove(); diff --git a/src/map/handler/Map.DoubleClickZoom.ts b/src/map/handler/Map.DoubleClickZoom.ts index 7f9283d000..32bb88cb7f 100644 --- a/src/map/handler/Map.DoubleClickZoom.ts +++ b/src/map/handler/Map.DoubleClickZoom.ts @@ -18,6 +18,7 @@ class MapDoubleClickZoomHandler extends Handler { this.target.off('_dblclick', this._onDoubleClick, this); } + //@interlal _onDoubleClick(param: Param) { const map = this.target; if (map.options['doubleClickZoom']) { diff --git a/src/map/handler/Map.Drag.ts b/src/map/handler/Map.Drag.ts index a1f9e78422..80ca8810d8 100644 --- a/src/map/handler/Map.Drag.ts +++ b/src/map/handler/Map.Drag.ts @@ -7,19 +7,24 @@ import { type Param } from './CommonType'; class MapDragHandler extends Handler { + //@interlal _dragHandler: DragHandler startDragTime: number startBearing: number + //@interlal _mode: 'rotatePitch' | 'move' preX: number preY: number startX: number startY: number // TODO:等待补充Coordinate类型定义 + //@interlal _startPrjCenter: any // TODO:等待补充Coordinate类型定义 startPrjCoord: any + //@interlal _rotateMode: 'rotate_pitch' | 'rotate' | 'pitch' + //@interlal _db: number // TODO:等待补充Map类型定义 // target: Map @@ -50,6 +55,7 @@ class MapDragHandler extends Handler { delete this._dragHandler; } + //@interlal _cancelOn(domEvent: any) { if (this.target.isZooming() || this._ignore(domEvent)) { return true; @@ -57,6 +63,7 @@ class MapDragHandler extends Handler { return false; } + //@interlal _ignore(param: any) { if (!param) { return false; @@ -67,6 +74,7 @@ class MapDragHandler extends Handler { return this.target._ignoreEvent(param) || this.target._isEventOutMap(param); } + //@interlal _onMouseDown(param: any) { delete this.startDragTime; delete this._mode; @@ -85,6 +93,7 @@ class MapDragHandler extends Handler { preventDefault(param['domEvent']); } + //@interlal _onDragStart(param) { this.startDragTime = now(); if (this._mode === 'move') { @@ -94,6 +103,7 @@ class MapDragHandler extends Handler { } } + //@interlal _onDragging(param) { const map = this.target; if (map._isEventOutMap(param['domEvent'])) { @@ -106,6 +116,7 @@ class MapDragHandler extends Handler { } } + //@interlal _onDragEnd(param) { if (this._mode === 'move') { this._moveEnd(param); @@ -116,6 +127,7 @@ class MapDragHandler extends Handler { delete this.startBearing; } + //@interlal _start(param) { this.preX = param['mousePos'].x; this.preY = param['mousePos'].y; @@ -124,6 +136,7 @@ class MapDragHandler extends Handler { this._startPrjCenter = this.target._getPrjCenter().copy(); } + //@interlal _moveStart(param) { this._start(param); const map = this.target; @@ -132,6 +145,7 @@ class MapDragHandler extends Handler { this.startPrjCoord = this._containerPointToPrj(p); } + //@interlal _moving(param) { if (!this.startDragTime) { return; @@ -145,6 +159,7 @@ class MapDragHandler extends Handler { map.onMoving(param); } + //@interlal _containerPointToPrj(p) { const map = this.target; const queryCoord = map._queryTerrainInfo(p); @@ -156,6 +171,7 @@ class MapDragHandler extends Handler { return map._containerPointToPrj(p); } + //@interlal _moveEnd(param: Param) { if (!this.startDragTime) { return; @@ -183,6 +199,7 @@ class MapDragHandler extends Handler { } } + //@interlal _rotateStart(param: Param) { this._start(param); delete this._rotateMode; @@ -191,6 +208,7 @@ class MapDragHandler extends Handler { this._db = 0; } + //@interlal _rotating(param: Param) { const map = this.target; const mx = param['mousePos'].x, @@ -242,6 +260,7 @@ class MapDragHandler extends Handler { } } + //@interlal _rotateEnd(param: Param) { const map = this.target; const bearing = map.getBearing(); @@ -259,6 +278,7 @@ class MapDragHandler extends Handler { } } + //@interlal _clear() { delete this.startPrjCoord; delete this.preX; diff --git a/src/map/handler/Map.GeometryEvents.ts b/src/map/handler/Map.GeometryEvents.ts index 5ea7a0a4c8..03b6a523b5 100644 --- a/src/map/handler/Map.GeometryEvents.ts +++ b/src/map/handler/Map.GeometryEvents.ts @@ -185,7 +185,9 @@ const fireGeoEvent = (geometry, domEvent, type?) => { }; class MapGeometryEventsHandler extends Handler { + //@interlal _mouseDownTime: number + //@interlal _queryIdentifyTimeout: number // target: Map; @@ -201,6 +203,7 @@ class MapGeometryEventsHandler extends Handler { off(dom, EVENTS, this._identifyGeometryEvents); } + //@interlal _identifyGeometryEvents(domEvent, type) { const map = this.target; if (map.isInteracting() || map._ignoreEvent(domEvent)) { diff --git a/src/map/handler/Map.ScrollWheelZoom.ts b/src/map/handler/Map.ScrollWheelZoom.ts index 72db308ba3..d792e90c6c 100644 --- a/src/map/handler/Map.ScrollWheelZoom.ts +++ b/src/map/handler/Map.ScrollWheelZoom.ts @@ -17,21 +17,36 @@ const wheelZoomRate = 1 / 450; const maxScalePerFrame = 2; class MapScrollWheelZoomHandler extends Handler { - private _thisScrollZoom: () => void - private _thisCheckIfEndZoom: () => void + //@interlal + _thisScrollZoom: () => void + //@interlal + _thisCheckIfEndZoom: () => void + //@interlal _wheelZoomRate: number + //@interlal _defaultZoomRate: number + //@interlal _delta: number + //@interlal _zooming: boolean + //@interlal _trackPadSuspect: number + //@interlal _ensureTrackpad: boolean + //@interlal _active: boolean + //@interlal _requesting: number + //@interlal _startZoom: number + //@interlal _origin: any + //@interlal _zoomOrigin: any + //@interlal _lastWheelEvent: any - private _scrollTime: number + //@interlal + _scrollTime: number constructor(target) { super(target); @@ -50,6 +65,7 @@ class MapScrollWheelZoomHandler extends Handler { removeDomEvent(this.target._containerDOM, 'wheel', this._onWheelScroll); } + //@interlal _onWheelScroll(evt) { const map = this.target; if (map.options['preventWheelScroll']) { @@ -73,6 +89,7 @@ class MapScrollWheelZoomHandler extends Handler { } } + //@interlal _seamless(evt, origin) { let value = evt.deltaMode === window.WheelEvent.DOM_DELTA_LINE ? evt.deltaY * 60 : evt.deltaY; if (value % wheelZoomDelta !== 0) { @@ -110,6 +127,7 @@ class MapScrollWheelZoomHandler extends Handler { this._start(); } + //@interlal _start() { if (!this._delta) return; this._zooming = true; @@ -120,6 +138,7 @@ class MapScrollWheelZoomHandler extends Handler { } } + //@interlal _scrollZoom() { this._active = false; if (!this._delta) { @@ -139,6 +158,7 @@ class MapScrollWheelZoomHandler extends Handler { map.getRenderer().callInNextFrame(this._thisCheckIfEndZoom); } + //@interlal _checkIfEndZoom() { if (!this._zooming) { return; @@ -154,6 +174,7 @@ class MapScrollWheelZoomHandler extends Handler { } } + //@interlal _interval(evt, origin) { const map = this.target; if (this._zooming) { diff --git a/src/map/handler/Map.Touch.ts b/src/map/handler/Map.Touch.ts index 14802e64ee..f5544b2ff9 100644 --- a/src/map/handler/Map.Touch.ts +++ b/src/map/handler/Map.Touch.ts @@ -6,14 +6,22 @@ import Map from '../Map'; //handler to zoom map by pinching class MapTouchZoomHandler extends Handler { preY: number + //@interlal _startP1: Point + //@interlal _startP2: Point + //@interlal _startDist: number + //@interlal _startVector: Point + //@interlal _startZoom: number + //@interlal _startBearing: number mode: 'rotate_zoom' | 'pitch' | 'rotate' | 'zoom' + //@interlal _scale: number + //@interlal _Origin: Point addHooks() { @@ -24,6 +32,7 @@ class MapTouchZoomHandler extends Handler { removeDomEvent(this.target.getContainer(), 'touchstart', this._onTouchStart); } + //@interlal _onTouchStart(event) { const map = this.target; if (!event.touches || event.touches.length < 2) { @@ -59,6 +68,7 @@ class MapTouchZoomHandler extends Handler { map._fireEvent('touchactstart'); } + //@interlal _onTouchMove(event) { const map = this.target; if (!event.touches || event.touches.length < 2) { @@ -113,6 +123,7 @@ class MapTouchZoomHandler extends Handler { map._fireEvent('touchactinging'); } + //@interlal _startTouching(param) { const map = this.target; if (this.mode === 'zoom' || this.mode === 'rotate_zoom') { @@ -125,6 +136,7 @@ class MapTouchZoomHandler extends Handler { } } + //@interlal _onTouchEnd(event) { delete this.preY; const map = this.target; diff --git a/src/map/spatial-reference/SpatialReference.ts b/src/map/spatial-reference/SpatialReference.ts index 00a0a443ca..c6b9495b9f 100644 --- a/src/map/spatial-reference/SpatialReference.ts +++ b/src/map/spatial-reference/SpatialReference.ts @@ -143,11 +143,16 @@ DefaultSpatialReference['PRESET-4490-512'] = DefaultSpatialReference['PRESET-VT- */ export default class SpatialReference { options: SpatialReferenceType + //@interlal _projection: ProjectionType isEPSG: boolean + //@interlal _resolutions: number[] + //@interlal _pyramid: boolean + //@interlal _fullExtent: Extent; + //@interlal _transformation: Transformation json: SpatialReferenceType constructor(options: SpatialReferenceType = ({} as SpatialReferenceType)) { @@ -281,6 +286,7 @@ export default class SpatialReference { return true; } + //@interlal _initSpatialRef() { let projection: ProjectionType; if (this.options['projection']) { diff --git a/src/map/tool/AreaTool.ts b/src/map/tool/AreaTool.ts index fb7130b958..3a72306832 100644 --- a/src/map/tool/AreaTool.ts +++ b/src/map/tool/AreaTool.ts @@ -16,7 +16,7 @@ export type AreaToolOptions = { /** * options 配置项说明 - * + * * @english * @property options * @property options.language - language of the distance tool, zh-CN or en-US @@ -44,7 +44,7 @@ const options: AreaToolOptions = { /** * 一个继承于DistanceTool类,测量面积的地图工具类。 - * + * * @english * A map tool to help measure area on the map .it is extends DistanceTool * @category maptool @@ -71,7 +71,7 @@ class AreaTool extends DistanceTool { options: AreaToolOptions; /** * 配置项 - * + * * @english * @param options option - construct options * @param options.language=zh-CN - language of the distance tool, zh-CN or en-US @@ -89,6 +89,7 @@ class AreaTool extends DistanceTool { this._measureLayers = []; } + //@interlal _measure(toMeasure: Geometry | Array) { const map: any = this.getMap(); let area: number; @@ -125,10 +126,12 @@ class AreaTool extends DistanceTool { return content; } + //@interlal _msGetCoordsToMeasure(param: any) { return param['geometry'].getShell().concat([param['coordinate']]); } + //@interlal _msOnDrawVertex(param: any) { // const prjCoord = this.getMap()._pointToPrj(param['point2d']); const lastCoordinate = this._getLasttCoordinate() || param.coordinate; @@ -141,6 +144,7 @@ class AreaTool extends DistanceTool { this._addVertexMarker(vertexMarker); } + //@interlal _msOnDrawEnd(param: any) { this._clearTailMarker(); let prjCoord; diff --git a/src/map/tool/DistanceTool.ts b/src/map/tool/DistanceTool.ts index 723d3671c8..822a9ce960 100644 --- a/src/map/tool/DistanceTool.ts +++ b/src/map/tool/DistanceTool.ts @@ -26,7 +26,7 @@ export type DistanceToolOptions = { /** * 配置项说明 - * + * * @english * @property options * @property {String} options.language - language of the distance tool, zh-CN or en-US @@ -96,7 +96,7 @@ const options: DistanceToolOptions = { /** * 距离测量工具类 - * + * * @english * A map tool to help measure distance on the map * @category maptool @@ -122,18 +122,25 @@ const options: DistanceToolOptions = { */ class DistanceTool extends DrawTool { options: DistanceToolOptions; + //@interlal _measureLayers: Array; translator: Translator; + //@interlal _tailMarker?: any; + //@interlal _tailLabel?: any; + //@interlal _lastMeasure?: number | string; + //@interlal _lastVertex?: any + //@interlal _measureMarkerLayer?: any + //@interlal _measureLineLayer?: any /** * 配置项 - * + * * @param options=null - construct options * @param options.language=zh-CN - language of the distance tool, zh-CN or en-US * @param options.metric=true - display result in metric system @@ -152,7 +159,7 @@ class DistanceTool extends DrawTool { /** * 清空测量 - * + * * @english * Clear the measurements * @return {DistanceTool} this @@ -172,7 +179,7 @@ class DistanceTool extends DrawTool { /** * 获取在绘制图形期间的VectorLayers - * + * * @english * Get the VectorLayers with the geometries drawn on the map during measuring. * @return {Array} @@ -183,7 +190,7 @@ class DistanceTool extends DrawTool { /** * 获取最后测量结果 - * + * * @english * Get last measuring result * @return {Number} @@ -197,7 +204,7 @@ class DistanceTool extends DrawTool { /** * 撤消绘图,仅适用于点击/删除模式 - * + * * @english * Undo drawing, only applicable for click/dblclick mode * @return {DistanceTool} this @@ -218,7 +225,7 @@ class DistanceTool extends DrawTool { /** * 重做绘图,只适用于click/dblclick模式 - * + * * @english * Redo drawing, only applicable for click/dblclick mode * @return {DistanceTool} this @@ -237,6 +244,7 @@ class DistanceTool extends DrawTool { return this; } + //@interlal _formatLabelContent(params: any) { const formatLabelContent = this.options.formatLabelContent; if (formatLabelContent && isFunction(formatLabelContent)) { @@ -245,6 +253,7 @@ class DistanceTool extends DrawTool { return null; } + //@interlal _measure(toMeasure: any) { const map: any = this.getMap(); let length; @@ -280,6 +289,7 @@ class DistanceTool extends DrawTool { return content; } + //@interlal _registerMeasureEvents() { this.on('drawstart', this._msOnDrawStart, this) .on('drawvertex', this._msOnDrawVertex, this) @@ -287,10 +297,12 @@ class DistanceTool extends DrawTool { .on('drawend', this._msOnDrawEnd, this); } + //@interlal _afterEnable() { this._registerMeasureEvents(); } + //@interlal _afterDisable() { this.off('drawstart', this._msOnDrawStart, this) .off('drawvertex', this._msOnDrawVertex, this) @@ -298,6 +310,7 @@ class DistanceTool extends DrawTool { .off('drawend', this._msOnDrawEnd, this); } + //@interlal _msOnDrawStart(param: any) { const map: any = this.getMap(); // const prjCoord = map._pointToPrj(param['point2d']); @@ -336,6 +349,7 @@ class DistanceTool extends DrawTool { this._addVertexMarker(marker, startLabel); } + //@interlal _msOnMouseMove(param: any) { const ms = this._measure(this._msGetCoordsToMeasure(param)); if (!this._tailMarker) { @@ -358,10 +372,12 @@ class DistanceTool extends DrawTool { // this._tailLabel._setPrjCoordinates(lastCoord); } + //@interlal _msGetCoordsToMeasure(param: any) { return param['geometry'].getCoordinates().concat([param['coordinate']]); } + //@interlal _msOnDrawVertex(param: any) { // const prjCoords = this._geometry._getPrjCoordinates(); // const lastCoord = prjCoords[prjCoords.length - 1]; @@ -382,6 +398,7 @@ class DistanceTool extends DrawTool { this._lastVertex = vertexLabel; } + //@interlal _addVertexMarker(marker: Marker, vertexLabel?: any) { if (!this._vertexes) { this._vertexes = []; @@ -396,6 +413,7 @@ class DistanceTool extends DrawTool { } } + //@interlal _msOnDrawEnd(param: any) { this._clearTailMarker(); if (param['geometry'].getCoordinates().length < 2) { @@ -417,6 +435,7 @@ class DistanceTool extends DrawTool { this._lastMeasure = geo.getLength(); } + //@interlal _addClearMarker(coordinates: Coordinate, prjCoord: any, dx: number | string) { let symbol = this.options['clearButtonSymbol']; let dxSymbol: any | Array = { @@ -450,6 +469,7 @@ class DistanceTool extends DrawTool { // endMarker._setPrjCoordinates(prjCoord); } + //@interlal _clearTailMarker() { if (this._tailMarker) { this._tailMarker.remove(); @@ -461,11 +481,13 @@ class DistanceTool extends DrawTool { } } + //@interlal _clearMeasureLayers() { this._measureLineLayer.remove(); this._measureMarkerLayer.remove(); } + //@interlal _getFirstCoordinate() { if (!this._geometry) { return null; @@ -474,6 +496,7 @@ class DistanceTool extends DrawTool { return coordinates[0]; } + //@interlal _getLasttCoordinate() { if (!this._geometry) { return null; diff --git a/src/map/tool/DrawTool.ts b/src/map/tool/DrawTool.ts index 3a681b7cc7..f87cf8656d 100644 --- a/src/map/tool/DrawTool.ts +++ b/src/map/tool/DrawTool.ts @@ -91,17 +91,29 @@ const registeredMode = {}; */ class DrawTool extends MapTool { options: DrawToolOptions; + //@interlal _vertexes: Array; + //@interlal _historyPointer: any; + //@interlal _events: any; + //@interlal _geometry?: any; + //@interlal _drawToolLayer?: any; + //@interlal _mapAutoPanAtEdge?: boolean; + //@interlal _geometryEvents?: boolean; + //@interlal _mapDoubleClickZoom?: boolean; + //@interlal _ending: boolean; + //@interlal _mapDraggable?: boolean; + //@interlal _clickCoords?: Array; + //@interlal _layers?: Array; /** @@ -348,14 +360,17 @@ class DrawTool extends MapTool { * @returns {boolean} * @private */ + //@interlal _shouldRecordHistory(actions) { return Array.isArray(actions) && actions[0] === 'click' && actions[1] === 'mousemove' && actions[2] === 'dblclick'; } + //@interlal _checkMode() { this._getRegisterMode(); } + //@interlal _saveMapCfg() { const map = this.getMap(); this._mapDoubleClickZoom = map.options['doubleClickZoom']; @@ -379,6 +394,7 @@ class DrawTool extends MapTool { } } + //@interlal _restoreMapCfg() { const map = this.getMap(); map.config({ @@ -391,6 +407,7 @@ class DrawTool extends MapTool { delete this._mapDoubleClickZoom; } + //@interlal _loadResources() { const symbol = this.getSymbol(); const resources = getExternalResources(symbol); @@ -400,10 +417,12 @@ class DrawTool extends MapTool { } } + //@interlal _getProjection() { return this._map.getProjection(); } + //@interlal _getRegisterMode() { const mode = this.getMode(); const registerMode = DrawTool.getRegisterMode(mode); @@ -418,7 +437,8 @@ class DrawTool extends MapTool { const _events = {}; if (Array.isArray(action)) { for (let i = 0; i < action.length; i++) { - _events[action[i]] = this._events[action[i]]; + //@interlal + _events[action[i]] = this._events[action[i]]; } return _events; } @@ -433,6 +453,7 @@ class DrawTool extends MapTool { * @param event * @private */ + //@interlal _mouseDownHandler(event: any) { this._createGeometry(event); } @@ -445,6 +466,7 @@ class DrawTool extends MapTool { * @param event * @private */ + //@interlal _mouseUpHandler(event: any) { this.endDraw(event); } @@ -457,6 +479,7 @@ class DrawTool extends MapTool { * @param event * @private */ + //@interlal _clickHandler(event: any) { if (!this.options.interactive) { return this; @@ -534,6 +557,7 @@ class DrawTool extends MapTool { * @param event * @private */ + //@interlal _createGeometry(event: any) { const mode = this.getMode(); const map: any = this.getMap() @@ -608,6 +632,7 @@ class DrawTool extends MapTool { * @param event * @private */ + //@interlal _mouseMoveHandler(event) { if (!this.options.interactive) { return this; @@ -677,6 +702,7 @@ class DrawTool extends MapTool { * @param event * @private */ + //@interlal _doubleClickHandler(event) { if (!this.options.interactive) { return this; @@ -715,6 +741,7 @@ class DrawTool extends MapTool { this.endDraw(event); } + //@interlal _addGeometryToStage(geometry) { const drawLayer = this._getDrawLayer(); drawLayer.addGeometry(geometry); @@ -765,6 +792,7 @@ class DrawTool extends MapTool { return this; } + //@interlal _clearStage() { this._getDrawLayer().clear(); delete this._geometry; @@ -780,6 +808,7 @@ class DrawTool extends MapTool { * @return * @private */ + //@interlal _getMouseContainerPoint(event: Event): Point { const action = this._getRegisterMode()['action']; if (action[0].indexOf('mousedown') >= 0 || action[0].indexOf('touchstart') >= 0) { @@ -789,6 +818,7 @@ class DrawTool extends MapTool { return event['containerPoint']; } + //@interlal _isValidContainerPoint(containerPoint) { const mapSize = this._map.getSize(); const w = mapSize['width'], @@ -801,6 +831,7 @@ class DrawTool extends MapTool { return true; } + //@interlal _getSnapResult(snapTo, containerPoint) { const map: any = this.getMap(); const lastContainerPoints = []; @@ -824,6 +855,7 @@ class DrawTool extends MapTool { }; } + //@interlal _getDrawLayer() { const drawLayerId = INTERNAL_LAYER_PREFIX + 'drawtool'; let drawToolLayer: any = this._map.getLayer(drawLayerId); @@ -839,6 +871,7 @@ class DrawTool extends MapTool { return drawToolLayer; } + //@interlal _fireEvent(eventName, param) { if (!param) { param = {}; @@ -851,6 +884,7 @@ class DrawTool extends MapTool { MapTool.prototype._fireEvent.call(this, eventName, param); } + //@interlal _pushLayers(layers) { if (!layers) { return this; @@ -867,6 +901,7 @@ class DrawTool extends MapTool { return this; } + //@interlal _outLayers(layers) { if (!layers) { return this; diff --git a/src/map/tool/MapTool.ts b/src/map/tool/MapTool.ts index bdf3bdd352..11d9411c3c 100644 --- a/src/map/tool/MapTool.ts +++ b/src/map/tool/MapTool.ts @@ -22,7 +22,9 @@ const key = '_map_tool'; * @mixes Eventable */ class MapTool extends Eventable(Class) { + //@interlal _map: Map; + //@interlal _enabled?: boolean; onEnable?(): void; getEvents?(): void; @@ -157,10 +159,12 @@ class MapTool extends Eventable(Class) { return this; } + //@interlal _registerEvents() { this._switchEvents('on'); } + //@interlal _switchEvents(to: any) { const events:any = this.getEvents(); if (events) { @@ -168,6 +172,7 @@ class MapTool extends Eventable(Class) { } } + //@interlal _fireEvent(eventName:string, param?: any) { if (!param) { param = {}; diff --git a/src/renderer/edit/EditHandle.ts b/src/renderer/edit/EditHandle.ts index 8ca0d6c46f..d21a83b97e 100644 --- a/src/renderer/edit/EditHandle.ts +++ b/src/renderer/edit/EditHandle.ts @@ -33,8 +33,11 @@ export default class EditHandle extends Eventable(Class) { url: string; bbox: BBOX; + //@interlal _point: Point; + //@interlal _img: any; + //@interlal _dragger: DragHandler; constructor(target: GeometryEditor, map: Map, options: EditHandleOptions) { @@ -56,6 +59,7 @@ export default class EditHandle extends Eventable(Class) { return this.options['cursor'] || 'default'; } + //@interlal _fetchImage() { const map = this.map; const symbol = this.options.symbol; diff --git a/src/renderer/geometry/CollectionPainter.ts b/src/renderer/geometry/CollectionPainter.ts index 301e6fb447..ab36de346c 100644 --- a/src/renderer/geometry/CollectionPainter.ts +++ b/src/renderer/geometry/CollectionPainter.ts @@ -15,6 +15,7 @@ const TEMP_EXTENT = new PointExtent(); * @private */ export default class CollectionPainter extends Class { + //@interlal _drawTime: number; bbox: BBOX; @@ -32,6 +33,7 @@ export default class CollectionPainter extends Class { this._drawTime = 0; } + //@interlal _setDrawTime(time: number) { this._drawTime = time; this._eachPainter((painter: Painter) => { @@ -59,6 +61,7 @@ export default class CollectionPainter extends Class { return null; } + //@interlal _eachPainter(fn: (p: Painter) => void) { const geometries = this.geometry.getGeometries(); let painter: Painter; diff --git a/src/renderer/geometry/Painter.ts b/src/renderer/geometry/Painter.ts index 280a0a7557..9975d90374 100644 --- a/src/renderer/geometry/Painter.ts +++ b/src/renderer/geometry/Painter.ts @@ -54,24 +54,43 @@ const TEMP_BBOX = { * @private */ class Painter extends Class { + //@interlal _drawTime: number; + //@interlal _hasPoint: boolean; + //@interlal _debugSymbolizer: DebugSymbolizer; + //@interlal _renderPoints: Record; + //@interlal _hitPoint: WithUndef; + //@interlal _sprite: any; + //@interlal _paintParams: any; + //@interlal _cachedParams: any; + //@interlal _unsimpledParams: any; + //@interlal _spriting: boolean; + //@interlal _extent2D: Extent & { _zoom: number }; + //@interlal _fixedExtent: PointExtent; + //@interlal _altAtGL: any; + //@interlal _propAlt: number | number[] | number[][]; + //@interlal _projCode: string; + //@interlal _pitched: boolean; + //@interlal _rotated: boolean; + //@interlal _painted: boolean; + //@interlal _containerBbox: typeof TEMP_BBOX; bbox: BBOX; @@ -93,6 +112,7 @@ class Painter extends Class { this._drawTime = 0; } + //@interlal _setDrawTime(time: number) { this._drawTime = time; return this; @@ -129,6 +149,7 @@ class Painter extends Class { /** * create symbolizers */ + //@interlal _createSymbolizers() { const geoSymbol = this.getSymbol(), symbolizers = [], @@ -270,6 +291,7 @@ class Painter extends Class { return tr; } + //@interlal _pointContainerPoints(points, dx, dy, ignoreAltitude, disableClip, pointPlacement, ptkey = '_pt') { if (this._aboveCamera()) { return null; @@ -428,6 +450,7 @@ class Painter extends Class { return cPoints; } + //@interlal _clip(points: Point[], altitude?: number) { // linestring polygon clip if (isNumber(altitude) && altitude !== 0) { @@ -461,11 +484,13 @@ class Painter extends Class { const mapStateCache = renderer.mapStateCache; let _2DExtent, glExtent, pitch; if (mapStateCache) { - _2DExtent = mapStateCache._2DExtent; + //@interlal + _2DExtent = mapStateCache._2DExtent; glExtent = mapStateCache.glExtent; pitch = mapStateCache.pitch; } else { - _2DExtent = map.get2DExtent(); + //@interlal + _2DExtent = map.get2DExtent(); glExtent = map.get2DExtentAtRes(map.getGLRes()); pitch = map.getPitch(); } @@ -561,6 +586,7 @@ class Painter extends Class { * @param {Number|Number[]} altitude * @private */ + //@interlal _interpolateSegAlt(clipSegs, orig, altitude) { if (!Array.isArray(altitude)) { const fn = cc => cc.point; @@ -599,6 +625,7 @@ class Painter extends Class { return this.geometry._getInternalSymbol(); } + //@interlal _resetSymbolizersBBOX() { //reset all symbolizers render bbox for (let i = this.symbolizers.length - 1; i >= 0; i--) { @@ -730,6 +757,7 @@ class Painter extends Class { return !!this._hitPoint; } + //@interlal _prepareShadow(ctx: CanvasRenderingContext2D, symbol: Record) { if (symbol['shadowBlur']) { //Ignore shadows when hit detection @@ -745,6 +773,7 @@ class Painter extends Class { } } + //@interlal _eachSymbolizer(fn, context?: any) { if (!this.symbolizers) { return; @@ -798,6 +827,7 @@ class Painter extends Class { return this._extent2D.add(TEMP_FIXED_EXTENT); } + //@interlal _computeExtent2D(extent) { for (let i = this.symbolizers.length - 1; i >= 0; i--) { const symbolizer = this.symbolizers[i]; @@ -806,6 +836,7 @@ class Painter extends Class { return extent; } + //@interlal _computeFixedExtent(resources, extent) { for (let i = this.symbolizers.length - 1; i >= 0; i--) { const symbolizer = this.symbolizers[i]; @@ -816,6 +847,7 @@ class Painter extends Class { return extent; } + //@interlal _isDynamicSize() { for (let i = this.symbolizers.length - 1; i >= 0; i--) { const symbolizer = this.symbolizers[i]; @@ -826,6 +858,7 @@ class Painter extends Class { return false; } + //@interlal _aboveCamera() { let altitude = this.getMinAltitude(); const map = this.getMap(); @@ -901,6 +934,7 @@ class Painter extends Class { this._removeSymbolizers(); } + //@interlal _removeSymbolizers() { this._eachSymbolizer(function (symbolizer) { delete symbolizer.painter; @@ -947,6 +981,7 @@ class Painter extends Class { return this.maxAltitude; } + //@interlal _getGeometryAltitude() { const map = this.getMap(); if (!map) { @@ -967,6 +1002,7 @@ class Painter extends Class { return altitude; } + //@interlal _verifyProjection() { const projection = this.geometry._getProjection() || PROJECTION; if (this._projCode && this._projCode !== projection.code) { @@ -975,9 +1011,11 @@ class Painter extends Class { this._projCode = (projection as any).code; } + //@interlal _beforePaint() { } + //@interlal _afterPaint() { } } diff --git a/src/renderer/geometry/PointRenderer.ts b/src/renderer/geometry/PointRenderer.ts index fadbc3e5d3..5c671db2fc 100644 --- a/src/renderer/geometry/PointRenderer.ts +++ b/src/renderer/geometry/PointRenderer.ts @@ -10,6 +10,7 @@ import {WithNull} from "../../types/typings"; // 有中心点的图形的共同方法 const CenterPointRenderer = { + //@interlal _getRenderPoints(): [Point[], WithNull] { return [[this._getCenter2DPoint(this.getMap().getGLRes())], null]; } @@ -33,6 +34,7 @@ Circle.include(CenterPointRenderer); Sector.include(CenterPointRenderer); Rectangle.include({ + //@interlal _getRenderPoints(placement?: string): [Point[], WithNull] { const map = this.getMap(); const glRes = map.getGLRes(); @@ -54,6 +56,7 @@ Rectangle.include({ //---------------------------------------------------- const PolyRenderer = { + //@interlal _getRenderPoints(placement?: string) { const map = this.getMap(); const glRes = map.getGLRes(); @@ -144,7 +147,8 @@ const PolyRenderer = { declare module '../../geometry/LineString' { // @ts-expect-error 确实需要重写父类的属性 interface LineString { - _getRenderPoints(placement?: string): [Point[], WithNull]; + //@interlal + _getRenderPoints(placement?: string): [Point[], WithNull]; } } @@ -152,7 +156,8 @@ LineString.include(PolyRenderer); declare module '../../geometry/Polygon' { interface Polygon { - _getRenderPoints(placement?: string): [Point[], WithNull]; + //@interlal + _getRenderPoints(placement?: string): [Point[], WithNull]; } } diff --git a/src/renderer/geometry/VectorRenderer.ts b/src/renderer/geometry/VectorRenderer.ts index e78bd6f8b3..0832b6f292 100644 --- a/src/renderer/geometry/VectorRenderer.ts +++ b/src/renderer/geometry/VectorRenderer.ts @@ -42,10 +42,13 @@ function isWithinPixel(painter: Painter) { } const geometryInclude = { + //@interlal _redrawWhenPitch: () => false, + //@interlal _redrawWhenRotate: () => false, + //@interlal _getRenderBBOX(ctx: CanvasRenderingContext2D, points: Point[]) { if (!ctx.isHitTesting) { resetBBOX(BBOX_TEMP); @@ -88,14 +91,18 @@ function getRotatedShell() { } //for Ellipse,Circle, const el = { + //@interlal _redrawWhenPitch: (): boolean => true, + //@interlal _redrawWhenRotate: function (): boolean { return (this instanceof Ellipse) || (this instanceof Sector); }, + //@interlal _computeRotatedPrjExtent, getRotatedShell, + //@interlal _paintAsPath: function (): boolean { //why? when rotate need draw by path if (this.isRotated()) { @@ -107,6 +114,7 @@ const el = { return altitude > 0 || map.getPitch() || ((this instanceof Ellipse) && map.getBearing()); }, + //@interlal _getPaintParams(): any[] { const map = this.getMap(); if (this._paintAsPath()) { @@ -118,6 +126,7 @@ const el = { return [pt, ...size]; }, + //@interlal _paintOn: function (...args: any[]) { if (this._paintAsPath()) { // @ts-expect-error @@ -128,6 +137,7 @@ const el = { } }, + //@interlal _getRenderSize(pt: Coordinate) { const map = this.getMap(), glRes = map.getGLRes(); @@ -153,6 +163,7 @@ declare module '../../geometry/Circle' { Circle.include(el); const rectangleInclude = { + //@interlal _getPaintParams() { const map = this.getMap(); const shell = this._getPrjShell(); @@ -160,7 +171,9 @@ const rectangleInclude = { return [points]; }, + //@interlal _paintOn: Canvas.polygon, + //@interlal _computeRotatedPrjExtent, getRotatedShell }; @@ -175,8 +188,10 @@ declare module '../../geometry/Rectangle' { Rectangle.include(rectangleInclude); const sectorInclude = { + //@interlal _redrawWhenPitch: (): boolean => true, + //@interlal _getPaintParams(): [Point, number, [number, number]] { if (this._paintAsPath()) { return Polygon.prototype._getPaintParams.call(this, true); @@ -192,6 +207,7 @@ const sectorInclude = { ]; }, + //@interlal _paintOn: function (...args: any[]) { if (this._paintAsPath()) { // @ts-expect-error @@ -219,11 +235,13 @@ Sector.include(el, sectorInclude); declare module '../../geometry/Path' { interface Path { - _paintAsPath: () => boolean; + //@interlal + _paintAsPath: () => boolean; } } Path.include({ + //@interlal _paintAsPath: () => true }); @@ -233,6 +251,7 @@ const lineStringInclude = { 'classic': [3, 4] }, + //@interlal _getArrowShape(prePoint?: Point, point?: any, lineWidth?: number, arrowStyle?: any, tolerance?: number) { if (!prePoint || !point || prePoint.equals(point)) { return null; @@ -264,12 +283,14 @@ const lineStringInclude = { return [p0, point, p2, p0]; }, + //@interlal _getPaintParams(): [Point[]] { const prjVertexes = this._getPrjCoordinates(); const points = this._getPath2DPoints(prjVertexes, false, this.getMap().getGLRes()); return [points]; }, + //@interlal _paintOn(ctx: CanvasRenderingContext2D, points: Point[], lineOpacity?: number, fillOpacity?: number, dasharray?: number[]) { const r = isWithinPixel(this._painter); if (r.within) { @@ -283,10 +304,12 @@ const lineStringInclude = { return this._getRenderBBOX(ctx, points); }, + //@interlal _getArrowPlacement() { return this.options['arrowPlacement']; }, + //@interlal _getArrowStyle() { const arrowStyle = this.options['arrowStyle']; if (arrowStyle) { @@ -295,6 +318,7 @@ const lineStringInclude = { return null; }, + //@interlal _getArrows(points: Array | Array>, lineWidth: number, tolerance?: number) { const arrowStyle = this._getArrowStyle(); if (!arrowStyle || points.length < 2) { @@ -367,6 +391,7 @@ const lineStringInclude = { return arrows; }, + //@interlal _getArrowPoints(arrows: any[], segments: any[], lineWidth?: number, arrowStyle?: any, tolerance?: number) { for (let ii = 0, ll = segments.length - 1; ii < ll; ii++) { const pre = segments[ii]; @@ -379,6 +404,7 @@ const lineStringInclude = { } }, + //@interlal _paintArrow(ctx: CanvasRenderingContext2D, points: Point[], lineOpacity?: number) { let lineWidth = this._getInternalSymbol()['lineWidth']; if (!isNumber(lineWidth) || lineWidth < 3) { @@ -408,6 +434,7 @@ declare module '../../geometry/LineString' { LineString.include(lineStringInclude); const polygonInclude = { + //@interlal _getPaintParams(disableSimplify?: boolean) { const glRes = this.getMap().getGLRes(); const prjVertexes = this._getPrjShell(); @@ -450,6 +477,7 @@ const polygonInclude = { return [points]; }, + //@interlal _paintOn(ctx: CanvasRenderingContext2D, points: Point[], lineOpacity?: number, fillOpacity?: number, dasharray?: number[]) { const r = isWithinPixel(this._painter); if (r.within) { @@ -463,7 +491,8 @@ const polygonInclude = { declare module '../../geometry/Polygon' { interface Polygon { - _paintOn(ctx: CanvasRenderingContext2D, points: Point[], lineOpacity?: number, fillOpacity?: number, dasharray?: number[]): WithNull; + //@interlal + _paintOn(ctx: CanvasRenderingContext2D, points: Point[], lineOpacity?: number, fillOpacity?: number, dasharray?: number[]): WithNull; } } diff --git a/src/renderer/geometry/symbolizers/CanvasSymbolizer.ts b/src/renderer/geometry/symbolizers/CanvasSymbolizer.ts index 16d5b77586..a4d313fa8d 100644 --- a/src/renderer/geometry/symbolizers/CanvasSymbolizer.ts +++ b/src/renderer/geometry/symbolizers/CanvasSymbolizer.ts @@ -18,8 +18,10 @@ import { ResourceCache } from '../../layer/CanvasRenderer'; * @extends {Symbolizer} */ abstract class CanvasSymbolizer extends Symbolizer { - public symbol: any; - public _opacityFn: any; + symbol: any; + //@interlal + _opacityFn: any; + //@interlal _prepareContext(ctx: CanvasRenderingContext2D): void { if (isFunctionDefinition(this.symbol['opacity'])) { if (!this._opacityFn) { @@ -56,6 +58,7 @@ abstract class CanvasSymbolizer extends Symbolizer { hide(): void { } + //@interlal _defineStyle(style: any): any { if (this.symbol) { style.visible = this.symbol.visible; diff --git a/src/renderer/geometry/symbolizers/DrawAltitudeSymbolizer.ts b/src/renderer/geometry/symbolizers/DrawAltitudeSymbolizer.ts index ebc1fb9f84..9c1dbbe600 100644 --- a/src/renderer/geometry/symbolizers/DrawAltitudeSymbolizer.ts +++ b/src/renderer/geometry/symbolizers/DrawAltitudeSymbolizer.ts @@ -14,7 +14,7 @@ const defaultSymbol = { }; export default class DrawAltitudeSymbolizer extends PointSymbolizer { - public dxdy: any; + dxdy: any; static test(symbol: any, geometry: Geometry) { const layer = geometry.getLayer(); if (!layer) { @@ -92,16 +92,19 @@ export default class DrawAltitudeSymbolizer extends PointSymbolizer { return 'point'; } + //@interlal _getPaintParams(dx: any, dy: any): any[] { return this.getPainter().getPaintParams(dx || 0, dy || 0, null, true, '_altpt'); } + //@interlal _drawMarkerAltitude(ctx: CanvasRenderingContext2D, point: Point, groundPoint: Point): void { const style = this._getStyle(); this.prepareCanvas(ctx, style); Canvas.path(ctx, [point, groundPoint], style['lineOpacity'], null, style['lineDasharray']); } + //@interlal _drawLineAltitude(ctx: CanvasRenderingContext2D, points: any[], groundPoints: any[]): void { const style = this._getStyle(); const isSplitted = points.length > 0 && Array.isArray(points[0]); @@ -119,6 +122,7 @@ export default class DrawAltitudeSymbolizer extends PointSymbolizer { } } + //@interlal _drawLine(ctx: CanvasRenderingContext2D, points: any[], groundPoints: any[]): void { const style = this._getStyle(); this.prepareCanvas(ctx, style); @@ -127,6 +131,7 @@ export default class DrawAltitudeSymbolizer extends PointSymbolizer { } } + //@interlal _getStyle(): any { // read drawAltitude from layer every time const layer = this.geometry.getLayer(); diff --git a/src/renderer/geometry/symbolizers/ImageMarkerSymbolizer.ts b/src/renderer/geometry/symbolizers/ImageMarkerSymbolizer.ts index 2c233c7ef2..fb527dd57b 100644 --- a/src/renderer/geometry/symbolizers/ImageMarkerSymbolizer.ts +++ b/src/renderer/geometry/symbolizers/ImageMarkerSymbolizer.ts @@ -13,8 +13,10 @@ const TEMP_SIZE = new Size(1, 1); const TEMP_EXTENT = new PointExtent(); export default class ImageMarkerSymbolizer extends PointSymbolizer { - public _url: [string, string | number, string | number]; - public _fixedExtent: PointExtent; + //@interlal + _url: [string, string | number, string | number]; + //@interlal + _fixedExtent: PointExtent; static test(symbol: any): boolean { return isImageSymbol(symbol); } @@ -105,6 +107,7 @@ export default class ImageMarkerSymbolizer extends PointSymbolizer { } } + //@interlal _getImage(resources: ResourceCache): any { return getImage(resources, this.style['markerFile']); } diff --git a/src/renderer/geometry/symbolizers/PointSymbolizer.ts b/src/renderer/geometry/symbolizers/PointSymbolizer.ts index b18f64d2b6..ae2c290236 100644 --- a/src/renderer/geometry/symbolizers/PointSymbolizer.ts +++ b/src/renderer/geometry/symbolizers/PointSymbolizer.ts @@ -25,10 +25,10 @@ const TEMP_POINT3 = new Point(0, 0); * @extends {symbolizer.CanvasSymbolizer} */ abstract class PointSymbolizer extends CanvasSymbolizer { - public style: any; - public symbol: any; - public geometry: Geometry; - public painter: Painter; + style: any; + symbol: any; + geometry: Geometry; + painter: Painter; constructor(symbol: any, geometry: Geometry, painter: Painter) { super(); this.symbol = symbol; @@ -56,10 +56,12 @@ abstract class PointSymbolizer extends CanvasSymbolizer { } + //@interlal _rotateExtent(fixedExtent: PointExtent, angle: number): PointExtent { return fixedExtent.convertTo((p: Point) => p._rotate(angle)); } + //@interlal _getRenderPoints(): Point[][] { const painter = this.getPainter(); const placement = painter.isSpriting() ? 'center' : this.getPlacement(); @@ -72,6 +74,7 @@ abstract class PointSymbolizer extends CanvasSymbolizer { * @english * Get container points to draw on Canvas */ + //@interlal _getRenderContainerPoints(ignoreAltitude?: boolean): Point[] { const painter = this.getPainter(); if (painter.isSpriting()) { @@ -125,6 +128,7 @@ abstract class PointSymbolizer extends CanvasSymbolizer { return new Point(dx, dy); } + //@interlal _getRotationAt(i: number): number { let r = this.getRotation(); if (!r) { @@ -149,6 +153,7 @@ abstract class PointSymbolizer extends CanvasSymbolizer { } } + //@interlal _rotate(ctx: CanvasRenderingContext2D, origin: Point, rotation: number): Point | null { if (rotation) { const dxdy = this.getDxDy(); diff --git a/src/renderer/geometry/symbolizers/StrokeAndFillSymbolizer.ts b/src/renderer/geometry/symbolizers/StrokeAndFillSymbolizer.ts index 03325560ce..f11bf574d4 100644 --- a/src/renderer/geometry/symbolizers/StrokeAndFillSymbolizer.ts +++ b/src/renderer/geometry/symbolizers/StrokeAndFillSymbolizer.ts @@ -11,9 +11,12 @@ const TEMP_COORD0 = new Coordinate(0, 0); const TEMP_COORD1 = new Coordinate(0, 0); export default class StrokeAndFillSymbolizer extends CanvasSymbolizer { - public _extMin: Coordinate; - public _extMax: Coordinate; - public _pxExtent: PointExtent; + //@interlal + _extMin: Coordinate; + //@interlal + _extMax: Coordinate; + //@interlal + _pxExtent: PointExtent; static test(symbol: any, geometry: Geometry): boolean { if (!symbol) { return false; @@ -145,6 +148,7 @@ export default class StrokeAndFillSymbolizer extends CanvasSymbolizer { return new PointExtent(-t, -t, t, t); } + //@interlal _getPaintParams(): any[] { // @ts-expect-error todo fix must has four params return this.getPainter().getPaintParams(this.style['lineDx'], this.style['lineDy']); @@ -180,6 +184,7 @@ export default class StrokeAndFillSymbolizer extends CanvasSymbolizer { return result; } + //@interlal _createGradient(ctx: CanvasRenderingContext2D, points: any[], lineColor: any): void { if (!Array.isArray(points) || !points.length) { return; diff --git a/src/renderer/geometry/symbolizers/Symbolizer.ts b/src/renderer/geometry/symbolizers/Symbolizer.ts index 29a0fddd13..d897243d41 100644 --- a/src/renderer/geometry/symbolizers/Symbolizer.ts +++ b/src/renderer/geometry/symbolizers/Symbolizer.ts @@ -18,14 +18,15 @@ import Painter from "../Painter"; * @private */ abstract class Symbolizer { - public bbox: BBOX; - public geometry: Geometry; - public painter: Painter; - public style: any; + bbox: BBOX; + geometry: Geometry; + painter: Painter; + style: any; constructor() { this.bbox = getDefaultBBOX(); } + //@interlal _setBBOX(ctx: CanvasRenderingContext2D, x1?: number | BBOX, y1?: number, x2?: number, y2?: number): Symbolizer { if (!ctx.isHitTesting) { setBBOX(this.bbox, x1, y1, x2, y2); @@ -33,6 +34,7 @@ abstract class Symbolizer { return this; } + //@interlal _bufferBBOX(ctx: CanvasRenderingContext2D, bufferSize: number): Symbolizer { if (!ctx.isHitTesting) { bufferBBOX(this.bbox, bufferSize); diff --git a/src/renderer/geometry/symbolizers/TextMarkerSymbolizer.ts b/src/renderer/geometry/symbolizers/TextMarkerSymbolizer.ts index b04b1304f4..fa1a31cacb 100644 --- a/src/renderer/geometry/symbolizers/TextMarkerSymbolizer.ts +++ b/src/renderer/geometry/symbolizers/TextMarkerSymbolizer.ts @@ -14,11 +14,15 @@ import { ResourceCache } from '../..'; const TEMP_EXTENT = new PointExtent(); export default class TextMarkerSymbolizer extends PointSymbolizer { - public _dynamic: any; - public strokeAndFill: any; - public _textDesc: any; - public _fixedExtent: PointExtent; - public _index: number; + //@interlal + _dynamic: any; + strokeAndFill: any; + //@interlal + _textDesc: any; + //@interlal + _fixedExtent: PointExtent; + //@interlal + _index: number; static test(symbol: any): boolean { return isTextSymbol(symbol); diff --git a/src/renderer/geometry/symbolizers/VectorMarkerSymbolizer.ts b/src/renderer/geometry/symbolizers/VectorMarkerSymbolizer.ts index 7a31898607..a2aab7a404 100644 --- a/src/renderer/geometry/symbolizers/VectorMarkerSymbolizer.ts +++ b/src/renderer/geometry/symbolizers/VectorMarkerSymbolizer.ts @@ -19,11 +19,14 @@ const TEMP_EXTENT = new PointExtent(); const DEFAULT_ANCHOR = new Point(0, 0); export default class VectorMarkerSymbolizer extends PointSymbolizer { - public _dynamic: any; - public strokeAndFill: any; - public padding: number; - public _stamp: any; - public _fixedExtent: PointExtent; + //@interlal + _dynamic: any; + strokeAndFill: any; + padding: number; + //@interlal + _stamp: any; + //@interlal + _fixedExtent: PointExtent; static test(symbol: any): boolean { return isVectorSymbol(symbol); @@ -69,6 +72,7 @@ export default class VectorMarkerSymbolizer extends PointSymbolizer { } } + //@interlal _drawMarkers(ctx: CanvasRenderingContext2D, cookedPoints: any[], resources: ResourceCache) { for (let i = cookedPoints.length - 1; i >= 0; i--) { let point = cookedPoints[i]; @@ -96,6 +100,7 @@ export default class VectorMarkerSymbolizer extends PointSymbolizer { } } + //@interlal _drawMarkersWithCache(ctx: CanvasRenderingContext2D, cookedPoints: any[], resources: ResourceCache) { const stamp = this._stampSymbol(); let image = resources.getImage(stamp); @@ -128,6 +133,7 @@ export default class VectorMarkerSymbolizer extends PointSymbolizer { } } + //@interlal _createMarkerImage(ctx: CanvasRenderingContext2D, resources: ResourceCache): any { const canvasClass = ctx.canvas.constructor, size = calVectorMarkerSize(MARKER_SIZE, this.style), @@ -138,6 +144,7 @@ export default class VectorMarkerSymbolizer extends PointSymbolizer { return canvas; } + //@interlal _stampSymbol(): any { if (!this._stamp) { this._stamp = hashCode([ @@ -159,6 +166,7 @@ export default class VectorMarkerSymbolizer extends PointSymbolizer { return this._stamp; } + //@interlal _getCacheImageAnchor(w: number, h: number): Point { const shadow = 2 * (this.symbol['shadowBlur'] || 0), margin = shadow + this.padding; @@ -172,6 +180,7 @@ export default class VectorMarkerSymbolizer extends PointSymbolizer { } } + //@interlal _getGraidentExtent(points: PointExtent | Extent): PointExtent { const e = new PointExtent(), dxdy = this.getDxDy(), @@ -190,6 +199,7 @@ export default class VectorMarkerSymbolizer extends PointSymbolizer { return e; } + //@interlal _drawVectorMarker(ctx: CanvasRenderingContext2D, point: Point, resources: ResourceCache) { drawVectorMarker(ctx, point, this.style, resources); } diff --git a/src/renderer/geometry/symbolizers/VectorPathMarkerSymbolizer.ts b/src/renderer/geometry/symbolizers/VectorPathMarkerSymbolizer.ts index bb0c3b5b2d..7b75683a32 100644 --- a/src/renderer/geometry/symbolizers/VectorPathMarkerSymbolizer.ts +++ b/src/renderer/geometry/symbolizers/VectorPathMarkerSymbolizer.ts @@ -7,7 +7,8 @@ import { ResourceCache } from '../../layer/CanvasRenderer'; // import { ResourceProxy } from '../../../core/ResourceProxy'; export default class VectorPathMarkerSymbolizer extends ImageMarkerSymbolizer { - public _url: any; + //@interlal + _url: any; static test(symbol: any): boolean { return isPathSymbol(symbol); } @@ -33,10 +34,12 @@ export default class VectorPathMarkerSymbolizer extends ImageMarkerSymbolizer { } } + //@interlal _prepareContext(): void { //for VectorPathMarkerSymbolizer, opacity is already added into SVG element. } + //@interlal _getImage(resources: ResourceCache): any { if (resources && resources.isResourceLoaded(this._url)) { return resources.getImage(this._url); diff --git a/src/renderer/layer/CanvasRenderer.ts b/src/renderer/layer/CanvasRenderer.ts index 0fc283ce2f..b365b0991a 100644 --- a/src/renderer/layer/CanvasRenderer.ts +++ b/src/renderer/layer/CanvasRenderer.ts @@ -37,29 +37,42 @@ class ResourceWorkerConnection extends Actor { * @extends Class */ class CanvasRenderer extends Class { - public layer: any; - public resources: ResourceCache; - - public context: CanvasRenderingContext2D; - public canvas: TileRenderingCanvas; - public gl: TileRenderingContext; - public middleWest: Point; - public canvasExtent2D: Extent; + layer: any; + resources: ResourceCache; + + context: CanvasRenderingContext2D; + canvas: TileRenderingCanvas; + gl: TileRenderingContext; + middleWest: Point; + canvasExtent2D: Extent; + //@interlal _extent2D: Extent; + //@interlal _maskExtent: Extent; + //@interlal _painted: boolean; + //@interlal _drawTime: number; + //@interlal _frameTime: number; + //@interlal _resWorkerConn: ResourceWorkerConnection; + //@interlal _toRedraw: boolean; + //@interlal _loadingResource: boolean; + //@interlal _renderComplete: boolean; + //@interlal _canvasUpdated: boolean; + //@interlal _renderZoom: number; + //@interlal _errorThrown: boolean; + //@interlal __zoomTransformMatrix: number[]; drawOnInteracting?(...args: any[]): void; @@ -460,6 +473,7 @@ class CanvasRenderer extends Class { } + //@interlal _canvasContextScale(context: CanvasRenderingContext2D, dpr: number) { context.scale(dpr, dpr); context.dpr = dpr; @@ -798,6 +812,7 @@ class CanvasRenderer extends Class { return this._drawTime; } + //@interlal _tryToDraw(framestamp) { this._toRedraw = false; if (!this.canvas && this.layer.isEmpty && this.layer.isEmpty()) { @@ -808,6 +823,7 @@ class CanvasRenderer extends Class { this._drawAndRecord(framestamp); } + //@interlal _drawAndRecord(framestamp: number) { if (!this.getMap()) { return; @@ -824,6 +840,7 @@ class CanvasRenderer extends Class { } } + //@interlal _promiseResource(url) { const layer = this.layer; const resources = this.resources; @@ -900,6 +917,7 @@ class CanvasRenderer extends Class { } + //@interlal _cacheResource(url: [string, number | string, string | number], img: ImageType) { if (!this.layer || !this.resources) { return; @@ -928,7 +946,8 @@ export type ResourceUrl = string | string[] export class ResourceCache { resources: any; - private _errors: any; + //@interlal + _errors: any; constructor() { this.resources = {}; @@ -1026,6 +1045,7 @@ export class ResourceCache { return this; } + //@interlal _getImgUrl(url: ResourceUrl) { if (!Array.isArray(url)) { return url; diff --git a/src/renderer/layer/ImageGLRenderable.ts b/src/renderer/layer/ImageGLRenderable.ts index e802315253..1460528ccb 100644 --- a/src/renderer/layer/ImageGLRenderable.ts +++ b/src/renderer/layer/ImageGLRenderable.ts @@ -72,18 +72,25 @@ const ImageGLRenderable = function (Base: T) { gl: TileRenderingContext; canvas: TileRenderingCanvas; // HTMLCHTMLCanvasElementnvasElement canvas2?: TileRenderingCanvas; - _debugInfoCanvas?: TileRenderingCanvas; + //@interlal + _debugInfoCanvas?: TileRenderingCanvas; program?: TileRenderingProgram; // webgl point for layerAltitude - _layerAlt: number = 0; - _layerAltitude: number = 0; + //@interlal + _layerAlt: number = 0; + //@interlal + _layerAltitude: number = 0; layer?: any; texBuffer?: TileImageBuffer; - _debugBuffer?: TileImageBuffer; + //@interlal + _debugBuffer?: TileImageBuffer; posBuffer?: TileImageBuffer; - _imageBuffers?: TileImageBuffer[]; - _buffers?: TileImageBuffer[]; - _textures?: TileImageTexture[]; + //@interlal + _imageBuffers?: TileImageBuffer[]; + //@interlal + _buffers?: TileImageBuffer[]; + //@interlal + _textures?: TileImageTexture[]; getMap?(): Map; /** @@ -365,7 +372,8 @@ const ImageGLRenderable = function (Base: T) { delete image.glBuffer; } - _createTexture(image: TileImageType): TileImageTexture { + //@interlal + _createTexture(image: TileImageType): TileImageTexture { const gl = this.gl; const texture = this.getTexture() || gl.createTexture(); // Create a texture object // Bind the texture object to the target @@ -587,7 +595,8 @@ const ImageGLRenderable = function (Base: T) { return uSampler; } - _initUniforms(program: TileRenderingProgram, uniforms: string[]): void { + //@interlal + _initUniforms(program: TileRenderingProgram, uniforms: string[]): void { for (let i = 0; i < uniforms.length; i++) { let name = uniforms[i]; let uniform = uniforms[i]; @@ -603,7 +612,8 @@ const ImageGLRenderable = function (Base: T) { } } - _getUniform(program: TileRenderingProgram, uniformName: string): WebGLUniformLocation { + //@interlal + _getUniform(program: TileRenderingProgram, uniformName: string): WebGLUniformLocation { const gl = this.gl; const uniform = gl.getUniformLocation(program, uniformName); if (!uniform) { diff --git a/src/renderer/layer/canvaslayer/CanvasLayerRenderer.ts b/src/renderer/layer/canvaslayer/CanvasLayerRenderer.ts index 7fb76d6668..9755d1ef38 100644 --- a/src/renderer/layer/canvaslayer/CanvasLayerRenderer.ts +++ b/src/renderer/layer/canvaslayer/CanvasLayerRenderer.ts @@ -2,9 +2,12 @@ import Canvas from '../../../core/Canvas'; import CanvasRenderer from '../../../renderer/layer/CanvasRenderer'; export default class CanvasLayerRenderer extends CanvasRenderer { - public buffer: HTMLCanvasElement; + buffer: HTMLCanvasElement; + //@interlal _drawContext: any[]; + //@interlal _predrawed: boolean; + //@interlal _shouldClear: boolean; getPrepareParams() { @@ -115,6 +118,7 @@ export default class CanvasLayerRenderer extends CanvasRenderer { } } + //@interlal _prepareDrawParams() { if (!this.getMap()) { return null; @@ -133,6 +137,7 @@ export default class CanvasLayerRenderer extends CanvasRenderer { ]; } + //@interlal _drawLayer(...args: any[]) { const params = this._prepareDrawParams(); if (!params) { @@ -143,6 +148,7 @@ export default class CanvasLayerRenderer extends CanvasRenderer { this.completeRender(); } + //@interlal _drawLayerOnInteracting(...args: any[]) { if (!this.layer.drawOnInteracting) { return; diff --git a/src/renderer/layer/tilelayer/QuadStencil.ts b/src/renderer/layer/tilelayer/QuadStencil.ts index c08d115435..eab47f35bf 100644 --- a/src/renderer/layer/tilelayer/QuadStencil.ts +++ b/src/renderer/layer/tilelayer/QuadStencil.ts @@ -36,6 +36,7 @@ class QuadStencil { buffer: any; program: TileRenderingProgram; + //@interlal _savedProgram: TileRenderingProgram; colorLoc: WebGLUniformLocation; transformLoc: WebGLUniformLocation; @@ -129,11 +130,13 @@ class QuadStencil { return this; } + //@interlal _save() { const gl = this.gl; this._savedProgram = gl.program; } + //@interlal _restore() { const gl = this.gl; gl.program = this._savedProgram; @@ -142,6 +145,7 @@ class QuadStencil { } } + //@interlal _createBuffer() { const gl = this.gl; this.buffer = gl.createBuffer(); @@ -152,6 +156,7 @@ class QuadStencil { gl.bufferData(gl.ARRAY_BUFFER, this.quadVertices, gl.STATIC_DRAW); } + //@interlal _createProgram() { const { program, vertexShader, fragmentShader } = createProgram(this.gl, vert, frag); program.vertexShader = vertexShader; diff --git a/src/renderer/layer/tilelayer/TileLayerCanvasRenderer.ts b/src/renderer/layer/tilelayer/TileLayerCanvasRenderer.ts index ca0382fad2..59169aa863 100644 --- a/src/renderer/layer/tilelayer/TileLayerCanvasRenderer.ts +++ b/src/renderer/layer/tilelayer/TileLayerCanvasRenderer.ts @@ -68,25 +68,37 @@ class TileWorkerConnection extends Actor { class TileLayerCanvasRenderer extends CanvasRenderer { tilesInView: TilesInViewType; tilesLoading: { [key: string]: any }; + //@interlal _parentTiles: any[]; + //@interlal _childTiles: any[]; + //@interlal _tileZoom: number; + //@interlal _tileQueue: { tileInfo: any; tileData: any; }[]; + //@interlal _tileQueueIds: Set; tileCache: typeof LRUCache; + //@interlal _compareTiles: any; + //@interlal _tileImageWorkerConn: TileWorkerConnection; + //@interlal _renderTimestamp: number; + //@interlal _frameTiles: { empty: boolean; timestamp: number; }; + //@interlal _terrainHelper: TerrainHelper; + //@interlal _tilePlaceHolder: any; + //@interlal _frameTileGrids: TileGrids; drawingCurrentTiles: WithUndef; @@ -194,6 +206,7 @@ class TileLayerCanvasRenderer extends CanvasRenderer { return this._renderTimestamp || 0; } + //@interlal _getTilesInCurrentFrame() { const map = this.getMap(); const layer = this.layer; @@ -435,6 +448,7 @@ class TileLayerCanvasRenderer extends CanvasRenderer { return this._getTileFadingOpacity(tileImage) < 1; } + //@interlal _drawTiles(tiles, parentTiles, childTiles, placeholders, parentContext, missedTiles, incompleteTiles) { if (parentTiles.length) { //closer the latter (to draw on top) @@ -511,6 +525,7 @@ class TileLayerCanvasRenderer extends CanvasRenderer { } + //@interlal _drawChildTiles(childTiles, parentContext) { // _hasOwnSR 时,瓦片之间会有重叠,会产生z-fighting,所以背景瓦片要后绘制 this.drawingChildTiles = true; @@ -518,6 +533,7 @@ class TileLayerCanvasRenderer extends CanvasRenderer { delete this.drawingChildTiles; } + //@interlal _drawParentTiles(parentTiles, parentContext) { this.drawingParentTiles = true; this._parentTiles.forEach(t => this._drawTile(t.info, t.image, parentContext)); @@ -529,12 +545,14 @@ class TileLayerCanvasRenderer extends CanvasRenderer { // eslint-disable-next-line @typescript-eslint/no-unused-vars onDrawTileEnd(context: RenderContext, parentContext: RenderContext) { } + //@interlal _drawTile(info, image, parentContext) { if (image) { this.drawTile(info, image, parentContext); } } + //@interlal _drawTileAndCache(tile: Tile, parentContext) { if (this.isValidCachedTile(tile)) { this.tilesInView[tile.info.id] = tile; @@ -571,6 +589,7 @@ class TileLayerCanvasRenderer extends CanvasRenderer { * @private * limit tile number to load when map is interacting */ + //@interlal _getLoadLimit(): number { if (this.getMap().isInteracting()) { return this.layer.options['loadingLimitOnInteracting']; @@ -601,6 +620,7 @@ class TileLayerCanvasRenderer extends CanvasRenderer { super.clear(); } + //@interlal _isLoadingTile(tileId: TileId): boolean { return !!this.tilesLoading[tileId]; } @@ -614,6 +634,7 @@ class TileLayerCanvasRenderer extends CanvasRenderer { } // clip canvas to avoid rough edge of tiles + //@interlal _clipByPitch(ctx: CanvasRenderingContext2D): boolean { const map = this.getMap(); if (map.getPitch() <= map.options['maxVisualPitch']) { @@ -682,6 +703,7 @@ class TileLayerCanvasRenderer extends CanvasRenderer { return tileImage; } + //@interlal _fetchImage(image: any, tile: Tile['info']) { if (image instanceof Image) { image.src = tile.url; @@ -736,6 +758,7 @@ class TileLayerCanvasRenderer extends CanvasRenderer { this.setToRedraw(); } + //@interlal _consumeTileQueue(): void { let count = 0; const limit = this.layer.options['tileLimitPerFrame']; @@ -756,6 +779,7 @@ class TileLayerCanvasRenderer extends CanvasRenderer { /* eslint-enable no-unmodified-loop-condition */ } + //@interlal _computeAvgTileAltitude() { let sumMin = 0; let sumMax = 0; @@ -932,6 +956,7 @@ class TileLayerCanvasRenderer extends CanvasRenderer { return this._findChildTiles(info); } + //@interlal _findChildTiles(info: Tile['info']): Tile[] | any { const layer = this._getLayerOfTile(info.layer); const terrainTileMode = layer && layer.options['terrainTileMode'] && layer._isPyramidMode(); @@ -1085,6 +1110,7 @@ class TileLayerCanvasRenderer extends CanvasRenderer { return children; } + //@interlal _findChildTilesAt(children: Tile[], pmin: number, pmax: number, layer: any, childZoom: number) { const layerId = layer.getId(), res = layer.getSpatialReference().getResolution(childZoom); @@ -1114,6 +1140,7 @@ class TileLayerCanvasRenderer extends CanvasRenderer { return this._findParentTile(info, targetDiff); } + //@interlal _findParentTile(info: Tile['info'], targetDiff?: number): Tile { const map = this.getMap(), layer = this._getLayerOfTile(info.layer); @@ -1174,6 +1201,7 @@ class TileLayerCanvasRenderer extends CanvasRenderer { return true; } + //@interlal _getLayerOfTile(layerId: LayerId) { return this.layer.getChildLayer ? this.layer.getChildLayer(layerId) : this.layer; } @@ -1205,6 +1233,7 @@ class TileLayerCanvasRenderer extends CanvasRenderer { return cached; } + //@interlal _addTileToCache(tileInfo: Tile['info'], tileImage: Tile['image']) { if (this.isValidCachedTile({ info: tileInfo, image: tileImage } as Tile)) { const cached = { @@ -1227,6 +1256,7 @@ class TileLayerCanvasRenderer extends CanvasRenderer { return opacity; } + //@interlal _getTileFadingOpacity(tileImage: Tile['image']): number { if (!this.layer.options['fadeAnimation'] || !tileImage.loadTime) { return 1; @@ -1303,6 +1333,7 @@ class TileLayerCanvasRenderer extends CanvasRenderer { } } + //@interlal _generatePlaceHolder(res: number): HTMLCanvasElement { const map = this.getMap(); const placeholder = this.layer.options['placeholder']; @@ -1394,7 +1425,8 @@ export interface Tile { // todo:检查是否存在定义 minAltitude?: number; maxAltitude?: number; - _glScale: number; + //@interlal + _glScale: number; }; image: TileImage; diff --git a/src/renderer/layer/tilelayer/TileLayerGLRenderer.ts b/src/renderer/layer/tilelayer/TileLayerGLRenderer.ts index bd6b2177e5..19b8008580 100644 --- a/src/renderer/layer/tilelayer/TileLayerGLRenderer.ts +++ b/src/renderer/layer/tilelayer/TileLayerGLRenderer.ts @@ -109,6 +109,7 @@ class TileLayerGLRenderer extends ImageGLRenderable(TileLayerCanvasRenderer) { } } + //@interlal _bindGLBuffer(image: Tile['image'], w: number, h: number): void { if (!image.glBuffer) { image.glBuffer = this.bufferTileData(0, 0, w, h); diff --git a/src/renderer/layer/vectorlayer/OverlayLayerCanvasRenderer.ts b/src/renderer/layer/vectorlayer/OverlayLayerCanvasRenderer.ts index 7e526c843b..97d59b1652 100644 --- a/src/renderer/layer/vectorlayer/OverlayLayerCanvasRenderer.ts +++ b/src/renderer/layer/vectorlayer/OverlayLayerCanvasRenderer.ts @@ -10,6 +10,7 @@ interface MapStateCacheType { bearing: number; glScale: number; glRes: number; + //@interlal _2DExtent: Extent; glExtent: Extent; containerExtent: Extent; @@ -28,9 +29,12 @@ interface MapStateCacheType { * @extends renderer.CanvasRenderer */ class OverlayLayerRenderer extends CanvasRenderer { + //@interlal _geosToCheck: Geometries[]; + //@interlal _resourceChecked: boolean; clearImageData?(): void; + //@interlal _lastGeosToDraw: Geometry[]; mapStateCache: MapStateCacheType; @@ -81,6 +85,7 @@ class OverlayLayerRenderer extends CanvasRenderer { return super.render.apply(this, args); } + //@interlal _addGeoToCheckRes(res: Geometries | Geometries[]) { if (!res) { return; diff --git a/src/renderer/layer/vectorlayer/VectorLayerCanvasRenderer.ts b/src/renderer/layer/vectorlayer/VectorLayerCanvasRenderer.ts index 27b226a59e..e1de053479 100644 --- a/src/renderer/layer/vectorlayer/VectorLayerCanvasRenderer.ts +++ b/src/renderer/layer/vectorlayer/VectorLayerCanvasRenderer.ts @@ -43,14 +43,23 @@ function isDebug(layer: any) { * @param layer - layer to render */ class VectorLayerRenderer extends OverlayLayerCanvasRenderer { + //@interlal _lastRenderTime: number; + //@interlal _lastCollisionTime: number; + //@interlal _imageData: ImageData; + //@interlal _geosToDraw: Geometries[]; + //@interlal _lastGeosToDraw: Geometries[]; + //@interlal _hasPoint: boolean; + //@interlal _onlyHasPoint: WithUndef; + //@interlal _displayExtent: Extent; + //@interlal _drawnRes: number; renderEnd: boolean; @@ -66,6 +75,7 @@ class VectorLayerRenderer extends OverlayLayerCanvasRenderer { return this; } + //@interlal _geoIsCollision(geo: GeoType, collisionIndex: any) { if (!geo) { return false; @@ -258,6 +268,7 @@ class VectorLayerRenderer extends OverlayLayerCanvasRenderer { this.layer.forEach(fn, context); } + //@interlal _checkGeos() { const geos = this._getCurrentNeedRenderGeos(); for (let i = 0, len = geos.length; i < len; i++) { @@ -299,6 +310,7 @@ class VectorLayerRenderer extends OverlayLayerCanvasRenderer { return this; } + //@interlal _setDrawGeosDrawTime() { const time = now(); const drawTime = this.layer._drawTime; @@ -354,6 +366,7 @@ class VectorLayerRenderer extends OverlayLayerCanvasRenderer { this._geosToDraw.push(geo); } + //@interlal _collidesGeos() { const collision = this.layer.options['collision']; if (!collision) { @@ -398,6 +411,7 @@ class VectorLayerRenderer extends OverlayLayerCanvasRenderer { super.onGeometryPropertiesChange(param); } + //@interlal _updateDisplayExtent() { let extent2D = this.canvasExtent2D; if (this._maskExtent) { @@ -418,6 +432,7 @@ class VectorLayerRenderer extends OverlayLayerCanvasRenderer { return this.layer._hitGeos(geometries, point, options); } + //@interlal _updateMapStateCache() { const map = this.getMap(); const offset = map._pointToContainerPoint(this.middleWest)._add(0, -map.height / 2); @@ -435,7 +450,8 @@ class VectorLayerRenderer extends OverlayLayerCanvasRenderer { bearing, glScale, glRes, - _2DExtent, + //@interlal + _2DExtent, glExtent, containerExtent, offset @@ -450,6 +466,7 @@ class VectorLayerRenderer extends OverlayLayerCanvasRenderer { * Better performance of batch coordinate conversion * @param glRes */ + //@interlal _batchConversionMarkers(glRes: number) { this._onlyHasPoint = undefined; if (!this._constructorIsThis()) { @@ -537,6 +554,7 @@ class VectorLayerRenderer extends OverlayLayerCanvasRenderer { return pts; } + //@interlal _sortByDistanceToCamera(cameraPosition: Vector3) { if (!this.layer.options['sortByDistanceToCamera']) { return; @@ -571,6 +589,7 @@ class VectorLayerRenderer extends OverlayLayerCanvasRenderer { }); } + //@interlal _constructorIsThis(): boolean { return this.constructor === VectorLayerRenderer; } @@ -606,6 +625,7 @@ class VectorLayerRenderer extends OverlayLayerCanvasRenderer { return this.geoPainterList || []; } + //@interlal _checkSnapshotCanvas() { if (!this.isProgressiveRender()) { delete this.snapshotCanvas; @@ -634,6 +654,7 @@ class VectorLayerRenderer extends OverlayLayerCanvasRenderer { } + //@interlal _getCurrentNeedRenderGeos(): Geometries[] { const geos = this.layer._geoList || []; if (!this.isProgressiveRender()) { @@ -651,6 +672,7 @@ class VectorLayerRenderer extends OverlayLayerCanvasRenderer { return pageGeos; } + //@interlal _resetProgressiveRender() { if (isDebug(this.layer)) { console.log('progressiveRender resetProgressiveRender'); @@ -663,6 +685,7 @@ class VectorLayerRenderer extends OverlayLayerCanvasRenderer { this._clearSnapshotCanvas(); } + //@interlal _clearSnapshotCanvas() { const snapshotCanvas = this._checkSnapshotCanvas(); if (snapshotCanvas) { @@ -670,6 +693,7 @@ class VectorLayerRenderer extends OverlayLayerCanvasRenderer { } } + //@interlal _snapshot() { const progressiveRender = this.isProgressiveRender(); const geosToDraw = this._geosToDraw || []; @@ -709,6 +733,7 @@ class VectorLayerRenderer extends OverlayLayerCanvasRenderer { return this; } + //@interlal _drawSnapshot() { if (!this.isProgressiveRender()) { return this; diff --git a/src/renderer/map/MapCanvasRenderer.ts b/src/renderer/map/MapCanvasRenderer.ts index 73efabb841..67ad0517ec 100644 --- a/src/renderer/map/MapCanvasRenderer.ts +++ b/src/renderer/map/MapCanvasRenderer.ts @@ -27,29 +27,52 @@ const tempCollisionIndex = new CollisionIndex(); * @memberOf renderer */ class MapCanvasRenderer extends MapRenderer { + //@interlal _containerIsCanvas: boolean; + //@interlal _loopTime: number; + //@interlal _resizeTime: number; + //@interlal _resizeCount: number; + //@interlal _frameCycleRenderCount: number; + //@interlal _resizeEventList: ResizeObserverEntry[]; + //@interlal _needClear: boolean; + //@interlal _canvasUpdated: boolean; + //@interlal _isViewChanged: WithUndef; + //@interlal _spatialRefChanged: WithUndef; + //@interlal _resizeObserver: ResizeObserver; + //@interlal _resizeInterval: number; + //@interlal _checkSizeInterval: number; + //@interlal _hitDetectFrame: number; + //@interlal _animationFrame: number; + //@interlal _mapview: MapView; + //@interlal _zoomMatrix: number[]; + //@interlal _eventParam: any; + //@interlal _canvasIds: string[]; + //@interlal _updatedIds: string[]; + //@interlal _frameTimestamp: number; + //@interlal _checkPositionTime: number; + //@interlal _tops: (EditHandle | EditOutline)[]; context: CanvasRenderingContext2D; @@ -144,6 +167,7 @@ class MapCanvasRenderer extends MapRenderer { } //need redraw all layer,cause by collision/crs change/view change etc... + //@interlal _needRedrawAllLayers(layers: Layer[]) { if (this.isSpatialReferenceChanged()) { return true; @@ -281,6 +305,7 @@ class MapCanvasRenderer extends MapRenderer { * check if need to call layer's draw/drawInteracting * @param layer */ + //@interlal _checkLayerRedraw(layer: Layer): boolean { if (this.isSpatialReferenceChanged()) { return true; @@ -310,6 +335,7 @@ class MapCanvasRenderer extends MapRenderer { * @returns time to draw this layer * @private */ + //@interlal _drawCanvasLayerOnInteracting(layer: Layer, t: number, timeLimit: number, framestamp: number): number { const map = this.map, renderer = layer._getRenderer(), @@ -358,6 +384,7 @@ class MapCanvasRenderer extends MapRenderer { * Make sure layer are drawn on map when firing the events * @private */ + //@interlal _fireLayerLoadEvents() { if (this._updatedIds && this._updatedIds.length > 0) { const map = this.map; @@ -587,6 +614,7 @@ class MapCanvasRenderer extends MapRenderer { map._trySetCursor(cursor); } + //@interlal _getLayerImage(layer: Layer) { const renderer = layer._getRenderer(); if (renderer.getCanvasImage) { @@ -673,6 +701,7 @@ class MapCanvasRenderer extends MapRenderer { return this._isViewChanged; } + //@interlal _recordView() { const map = this.map; if (!map._onViewChange || map.isInteracting() || map.isAnimating()) { @@ -687,6 +716,7 @@ class MapCanvasRenderer extends MapRenderer { return this._spatialRefChanged; } + //@interlal _getMapView(): MapView { const map = this.map; const center = map._getPrjCenter(); @@ -701,6 +731,7 @@ class MapCanvasRenderer extends MapRenderer { }; } + //@interlal _lockFrameRenderEnable() { const { maxFPS } = this.map.options || {}; if (maxFPS <= 0 || GlobalConfig.maxFPS <= maxFPS) { @@ -713,6 +744,7 @@ class MapCanvasRenderer extends MapRenderer { /** * Main frame loop */ + //@interlal _frameLoop(framestamp: number) { if (!this.map) { this._cancelFrameLoop(); @@ -732,12 +764,14 @@ class MapCanvasRenderer extends MapRenderer { this._animationFrame = requestAnimFrame((framestamp: number) => { this._frameLoop(framestamp); }); } + //@interlal _cancelFrameLoop() { if (this._animationFrame) { cancelAnimFrame(this._animationFrame); } } + //@interlal _drawLayerCanvasImage(layer: Layer, layerImage: any, targetWidth?: number, targetHeight?: number) { const ctx = this.context; const point = layerImage['point'].round(); @@ -810,6 +844,7 @@ class MapCanvasRenderer extends MapRenderer { ctx.globalAlpha = alpha; } + //@interlal _drawCenterCross() { const cross = this.map.options['centerCross']; if (cross) { @@ -823,6 +858,7 @@ class MapCanvasRenderer extends MapRenderer { } } + //@interlal _drawContainerExtent() { const { cascadePitches } = this.map.options; const h30 = this.map.height - this.map._getVisualHeight(cascadePitches[0]); @@ -848,6 +884,7 @@ class MapCanvasRenderer extends MapRenderer { // console.log(extent.ymin, h30, h60); } + //@interlal _drawFog() { const map = this.map; if (map.getPitch() <= map.options['maxVisualPitch'] || !map.options['fog']) { @@ -873,6 +910,7 @@ class MapCanvasRenderer extends MapRenderer { ctx.fillRect(0, top, Math.ceil(clipExtent.getWidth()) * r, Math.ceil(h + fogThickness)); } + //@interlal _debugSky() { const map = this.map; if (!map) { @@ -888,6 +926,7 @@ class MapCanvasRenderer extends MapRenderer { return this; } + //@interlal _getAllLayerToRender() { return this.map._getLayers(); } @@ -899,6 +938,7 @@ class MapCanvasRenderer extends MapRenderer { Canvas2D.clearRect(this.context, 0, 0, this.canvas.width, this.canvas.height); } + //@interlal _updateCanvasSize() { if (!this.canvas || this._containerIsCanvas) { return false; @@ -938,6 +978,7 @@ class MapCanvasRenderer extends MapRenderer { this.context = this.canvas.getContext('2d'); } + //@interlal _updateDomPosition(framestamp: number) { if (this._checkPositionTime === undefined) { this._checkPositionTime = -Infinity; @@ -951,6 +992,7 @@ class MapCanvasRenderer extends MapRenderer { return this; } + //@interlal _handleResizeEventList(time: number) { if (!this._resizeEventList) { return this; @@ -973,6 +1015,7 @@ class MapCanvasRenderer extends MapRenderer { return this; } + //@interlal _checkSize() { if (!this.map) { return; @@ -980,6 +1023,7 @@ class MapCanvasRenderer extends MapRenderer { this.map.checkSize(); } + //@interlal _setCheckSizeInterval(interval: number) { // ResizeObserver priority of use // https://developer.mozilla.org/zh-CN/docs/Web/API/ResizeObserver @@ -1013,6 +1057,7 @@ class MapCanvasRenderer extends MapRenderer { } } + //@interlal _registerEvents() { const map = this.map; @@ -1055,6 +1100,7 @@ class MapCanvasRenderer extends MapRenderer { } } + //@interlal _onMapMouseMove(param: any) { const map = this.map; if (map.isInteracting() || !map.options['hitDetect']) { @@ -1068,6 +1114,7 @@ class MapCanvasRenderer extends MapRenderer { }); } + //@interlal _getCanvasLayers() { return this.map._getLayers(layer => layer.isCanvasRender()); } diff --git a/src/renderer/map/MapRenderer.ts b/src/renderer/map/MapRenderer.ts index 11e63ffb09..10d4498708 100644 --- a/src/renderer/map/MapRenderer.ts +++ b/src/renderer/map/MapRenderer.ts @@ -19,14 +19,22 @@ type handlerQueueFn = () => void abstract class MapRenderer extends Class { map: Map; + //@interlal _handlerQueue: handlerQueueFn[]; + //@interlal _frontCount: WithUndef; + //@interlal _backCount: WithUndef; + //@interlal _uiCount: WithUndef; + //@interlal _thisDocVisibilitychange: () => void; + //@interlal _thisDocDragStart: () => void; + //@interlal _thisDocDragEnd: () => void; + //@interlal _thisDocDPRChange: () => void; constructor(map: Map) { @@ -127,6 +135,7 @@ abstract class MapRenderer extends Class { this._frameLoop(); } + //@interlal _onDocVisibilitychange() { if (document.visibilityState !== 'visible') { return; @@ -134,6 +143,7 @@ abstract class MapRenderer extends Class { this.setToRedraw(); } + //@interlal _getWrapPanel() { if (!this.map) { return null; @@ -141,6 +151,7 @@ abstract class MapRenderer extends Class { const panels = this.map.getPanels(); return panels && panels.mapWrapper; } + //@interlal _onDocDragStart() { const wrapPanel = this._getWrapPanel(); if (wrapPanel) { @@ -149,6 +160,7 @@ abstract class MapRenderer extends Class { return; } + //@interlal _onDocDragEnd() { const wrapPanel = this._getWrapPanel(); if (wrapPanel) { @@ -157,6 +169,7 @@ abstract class MapRenderer extends Class { return; } + //@interlal _onDocDPRChange() { const map = this.map; if (!map || !map.options || map.options['devicePixelRatio'] || !map.checkSize || !map.getRenderer) { @@ -168,6 +181,7 @@ abstract class MapRenderer extends Class { } } + //@interlal _containerIsOffscreen() { const container = this.map.getContainer(); if (!container || !container.style || container.style.display === 'none') { diff --git a/src/renderer/types.ts b/src/renderer/types.ts index e867c7dd68..05366f52d6 100644 --- a/src/renderer/types.ts +++ b/src/renderer/types.ts @@ -1,6 +1,7 @@ export type TileRenderingCanvas = { gl?: TileRenderingContext; texture?: TileImageTexture; + //@interlal _parentTileTimestamp?: number; } & HTMLCanvasElement; diff --git a/src/ui/InfoWindow.ts b/src/ui/InfoWindow.ts index 59051861d4..c30993ba62 100644 --- a/src/ui/InfoWindow.ts +++ b/src/ui/InfoWindow.ts @@ -49,9 +49,11 @@ const EMPTY_SIZE = new Size(0, 0); class InfoWindow extends UIComponent { options: InfoWindowOptionsType; + //@interlal _onCloseBtnClick: (event: MouseEvent | TouchEvent) => void; // TODO: obtain class in super + //@interlal _getClassName() { return 'InfoWindow'; } @@ -216,6 +218,7 @@ class InfoWindow extends UIComponent { return dom; } + //@interlal _replaceTemplate(dom: Element) { const geo = this._owner as Geometry; if (this.options['enableTemplate'] && geo && geo.getProperties && dom && dom.innerHTML) { @@ -318,6 +321,7 @@ class InfoWindow extends UIComponent { } } + //@interlal _onAutoOpen(e: MapEventDataType) { const owner = this.getOwner(); setTimeout(() => { @@ -336,6 +340,7 @@ class InfoWindow extends UIComponent { }, 1); } + //@interlal _rectifyMouseCoordinte(owner: Geometry | Map, mouseCoordinate: Coordinate): Coordinate { if (owner instanceof LineString) { return this._rectifyLineStringMouseCoordinate(owner, mouseCoordinate).coordinate; @@ -350,6 +355,7 @@ class InfoWindow extends UIComponent { return mouseCoordinate; } + //@interlal _rectifyLineStringMouseCoordinate(lineString: LineString, mouseCoordinate: Coordinate) { const map = this.getMap(); const coordinates = lineString.getCoordinates() || []; @@ -447,6 +453,7 @@ class InfoWindow extends UIComponent { }; } + //@interlal _getWindowWidth() { const defaultWidth = options.width; let width = this.options['width']; diff --git a/src/ui/Menu.ts b/src/ui/Menu.ts index bc712037d4..65aed64b33 100644 --- a/src/ui/Menu.ts +++ b/src/ui/Menu.ts @@ -53,6 +53,7 @@ class Menu extends UIComponent { } // TODO: obtain class in super + //@interlal _getClassName() { return 'Menu'; } @@ -163,6 +164,7 @@ class Menu extends UIComponent { }; } + //@interlal _createMenuItemDom() { const me = this; const map = this.getMap(); @@ -214,6 +216,7 @@ class Menu extends UIComponent { return ul; } + //@interlal _getMenuWidth() { const defaultWidth = 160; const width = this.options['width'] || defaultWidth; diff --git a/src/ui/Menuable.ts b/src/ui/Menuable.ts index ae15d413bf..069a3a51d3 100644 --- a/src/ui/Menuable.ts +++ b/src/ui/Menuable.ts @@ -4,7 +4,9 @@ import Menu, { MenuItem, MenuOptionsType } from './Menu'; import { Coordinate } from '../geo'; interface MenuAbles { + //@interlal _menuOptions: MenuOptionsType; + //@interlal _menu: Menu; setMenu(options: MenuOptionsType): this; getMenu(): Menu; @@ -13,8 +15,11 @@ interface MenuAbles { getMenuItems(): Array; closeMenu(): this; removeMenu(): this; + //@interlal _bindMenu(): this; + //@interlal _unbindMenu(): this; + //@interlal _defaultOpenMenu(param: any): boolean; } @@ -210,6 +215,7 @@ const Menuable = { return this; }, + //@interlal _bindMenu() { if (!this._menuOptions) { return this; @@ -220,6 +226,7 @@ const Menuable = { return this; }, + //@interlal _unbindMenu() { if (this._menu) { this.closeMenu(); @@ -236,6 +243,7 @@ const Menuable = { * @return {Boolean} true | false to stop event propagation * @private */ + //@interlal _defaultOpenMenu(param) { // 如果用户想自定义右键菜单,其不应该setMenu,既然其设置了说明就是想用默认的menu,应该根据是否设置了menu为参考依据而不是 contextmenu监听次数 this.openMenu(param['coordinate']); diff --git a/src/ui/ToolTip.ts b/src/ui/ToolTip.ts index 55d72db1f3..45ac673d98 100644 --- a/src/ui/ToolTip.ts +++ b/src/ui/ToolTip.ts @@ -32,11 +32,15 @@ const options: ToolTipOptionsType = { class ToolTip extends UIComponent { options: ToolTipOptionsType; + //@interlal _content: string; + //@interlal _timeout: NodeJS.Timeout; + //@interlal _owner: Geometry; // TODO:obtain class in super + //@interlal _getClassName() { return 'ToolTip'; } @@ -167,6 +171,7 @@ class ToolTip extends UIComponent { * override UIComponent method * ignore altitude calculation */ + //@interlal _getViewPoint() { return this.getMap().coordToViewPoint(this._coordinate, undefined, 0) ._add(this.options['dx'], this.options['dy']); diff --git a/src/ui/UIComponent.ts b/src/ui/UIComponent.ts index 55a5a93000..87eb0f7589 100644 --- a/src/ui/UIComponent.ts +++ b/src/ui/UIComponent.ts @@ -76,15 +76,25 @@ const options: UIComponentOptionsType = { class UIComponent extends Eventable(Class) { options: UIComponentOptionsType; + //@interlal _owner: Map | Geometry; + //@interlal _coordinate: Coordinate; + //@interlal _showBySymbolChange: boolean; + //@interlal _mapEventsOn: boolean; + //@interlal __uiDOM: HTMLElement; + //@interlal _pos: Point; + //@interlal _autoPanId: NodeJS.Timeout; + //@interlal _domContentRect: { width: number, height: number }; + //@interlal _size: Size; + //@interlal _resizeObserver: ResizeObserver; /** @@ -109,6 +119,7 @@ class UIComponent extends Eventable(Class) { this.proxyOptions(); } + //@interlal _appendCustomClass(dom: HTMLElement) { if (!dom) { console.warn('dom is null:', dom); @@ -192,6 +203,7 @@ class UIComponent extends Eventable(Class) { return (this._owner as Geometry).getMap(); } + //@interlal _collides() { const map = this.getMap(); if (!map) { @@ -202,6 +214,7 @@ class UIComponent extends Eventable(Class) { return this; } + //@interlal _collidesEffect(show: boolean) { const dom = this.getDOM(); if (!dom) { @@ -511,6 +524,7 @@ class UIComponent extends Eventable(Class) { return this; } + //@interlal _roundPoint(point: Point) { if (this.options.roundPoint) { point = point._round(); @@ -532,6 +546,7 @@ class UIComponent extends Eventable(Class) { return p; } + //@interlal _getAnimation() { const anim = { 'fade': false, @@ -561,6 +576,7 @@ class UIComponent extends Eventable(Class) { return anim; } + //@interlal _getViewPoint() { let altitude = 0; //后期有了地形后,拿到的数据会带altitude,这里适配下,以后点击地图拿到的数据应该带海拔的(lng,lat,alt) @@ -589,12 +605,14 @@ class UIComponent extends Eventable(Class) { ._add(this.options['dx'], this.options['dy']); } + //@interlal _meterToPoint(center: Coordinate, altitude: number) { return altitude; // const map = this.getMap(); // return map.altitudeToPoint(altitude, map._getResolution()) * sign(altitude); } + //@interlal _autoPan() { const map = this.getMap(), dom = this.getDOM(); @@ -687,6 +705,7 @@ class UIComponent extends Eventable(Class) { * @return {Size} size * @private */ + //@interlal _measureSize(dom: HTMLElement) { const container = this._getUIContainer(); dom.style.position = 'absolute'; @@ -712,6 +731,7 @@ class UIComponent extends Eventable(Class) { * * @private */ + //@interlal _removePrevDOM() { if (this.onDomRemove) { this.onDomRemove(); @@ -757,22 +777,27 @@ class UIComponent extends Eventable(Class) { * @private * @return {String} cache key */ + //@interlal _uiDomKey() { return '__ui_' + this._getClassName(); } + //@interlal _singleton() { return this.options['single']; } + //@interlal _getUIContainer() { return this.getMap().getPanels()['ui']; } + //@interlal _getClassName() { return 'UIComponent'; } + //@interlal _switchMapEvents(to: string) { const map = this.getMap(); if (!map) { @@ -792,6 +817,7 @@ class UIComponent extends Eventable(Class) { } } + //@interlal _switchEvents(to: string) { //At the beginning,not bind map events,bind evetns when show // this._switchMapEvents(to); @@ -805,6 +831,7 @@ class UIComponent extends Eventable(Class) { } } + //@interlal _getDefaultEvents() { return { 'zooming rotate pitch': this.onEvent, @@ -815,6 +842,7 @@ class UIComponent extends Eventable(Class) { }; } + //@interlal _getOwnerEvents() { const events: { [key: string]: (...args) => void } = {}; if (this._owner && (this._owner instanceof Geometry)) { @@ -877,6 +905,7 @@ class UIComponent extends Eventable(Class) { } } + //@interlal _updatePosition() { if (!this.getMap()) { return this; @@ -887,6 +916,7 @@ class UIComponent extends Eventable(Class) { return this; } + //@interlal _setPosition() { const dom = this.getDOM(); if (!dom) return; @@ -896,6 +926,7 @@ class UIComponent extends Eventable(Class) { dom.style[TRANSFORM] = this._toCSSTranslate(p) + ' scale(1)'; } + //@interlal _toCSSTranslate(p: Point) { if (!p) { return ''; @@ -917,6 +948,7 @@ class UIComponent extends Eventable(Class) { } } + //@interlal _observerDomSize(dom: HTMLElement) { if (!dom || !Browser.resizeObserver || this._resizeObserver) { return this; @@ -965,6 +997,7 @@ class UIComponent extends Eventable(Class) { return false; } + //@interlal _bindDomEvents(dom: HTMLElement, to: string) { if (!dom) { return; @@ -980,6 +1013,7 @@ class UIComponent extends Eventable(Class) { } } + //@interlal _getDomEvents() { return { 'mouseover': this._onDomMouseover, @@ -987,6 +1021,7 @@ class UIComponent extends Eventable(Class) { }; } + //@interlal _configMapPreventWheelScroll(preventWheelScroll: boolean) { const map = this.getMap(); if (!map) { @@ -999,11 +1034,13 @@ class UIComponent extends Eventable(Class) { } // eslint-disable-next-line no-unused-vars + //@interlal _onDomMouseover() { this._configMapPreventWheelScroll(false); } // eslint-disable-next-line no-unused-vars + //@interlal _onDomMouseout() { this._configMapPreventWheelScroll(true); } diff --git a/src/ui/UIMarker.ts b/src/ui/UIMarker.ts index a8fedb04d5..54c73d8933 100644 --- a/src/ui/UIMarker.ts +++ b/src/ui/UIMarker.ts @@ -212,11 +212,16 @@ const domEvents = * }).addTo(map); */ class UIMarker extends Handlerable(UIComponent) { + //@interlal _markerCoord: Coordinate; options: UIMarkerOptionsType; + //@interlal _owner: Map; + //@interlal _mousedownEvent: MouseEvent; + //@interlal _mouseupEvent: MouseEvent; + //@interlal _touchstartTime: number; /** @@ -232,6 +237,7 @@ class UIMarker extends Handlerable(UIComponent) { } // TODO: obtain class in super + //@interlal _getClassName() { return 'UIMarker'; } @@ -443,10 +449,12 @@ class UIMarker extends Handlerable(UIComponent) { return false; } + //@interlal _registerDOMEvents(dom: HTMLElement) { on(dom, domEvents, this._onDomEvents, this); } + //@interlal _onDomEvents(e: MouseEvent, type?: string) { const event = this.getMap()._parseEvent(e, e.type); type = type || e.type; @@ -472,10 +480,12 @@ class UIMarker extends Handlerable(UIComponent) { } } + //@interlal _removeDOMEvents(dom: HTMLElement) { off(dom, domEvents, this._onDomEvents); } + //@interlal _mouseClickPositionIsChange() { const { x: x1, y: y1 } = this._mousedownEvent || {}; const { x: x2, y: y2 } = this._mouseupEvent || {}; @@ -486,6 +496,7 @@ class UIMarker extends Handlerable(UIComponent) { * Get the connect points of panel for connector lines. * @private */ + //@interlal _getConnectPoints() { const map = this.getMap(); const containerPoint = map.coordToContainerPoint(this.getCoordinates()); @@ -514,6 +525,7 @@ class UIMarker extends Handlerable(UIComponent) { return anchors; } + //@interlal _getViewPoint() { let alt = 0; if (this._owner) { @@ -526,10 +538,12 @@ class UIMarker extends Handlerable(UIComponent) { ._add(this.options['dx'], this.options['dy']); } + //@interlal _getDefaultEvents() { return extend({}, super._getDefaultEvents(), { 'zooming zoomend': this.onZoomFilter }); } + //@interlal _setPosition() { //show/hide zoomFilter this.onZoomFilter(); @@ -573,9 +587,13 @@ UIMarker.mergeOptions(options); const EVENTS = Browser.touch ? 'touchstart mousedown' : 'mousedown'; class UIMarkerDragHandler extends Handler { + //@interlal _lastCoord: Coordinate; + //@interlal _lastPoint: Point; + //@interlal _dragHandler: DragHandler; + //@interlal _isDragging: boolean; target: UIMarker; @@ -591,6 +609,7 @@ class UIMarkerDragHandler extends Handler { this.target.off(EVENTS, this._startDrag, this); } + //@interlal _startDrag(param) { const domEvent = param['domEvent']; if (domEvent.touches && domEvent.touches.length > 1 || domEvent.button === 2) { @@ -619,6 +638,7 @@ class UIMarkerDragHandler extends Handler { this.target.fire('dragstart', param); } + //@interlal _prepareDragHandler() { this._dragHandler = new DragHandler(this.target.getDOM(), { 'cancelOn': this._cancelOn.bind(this), @@ -630,6 +650,7 @@ class UIMarkerDragHandler extends Handler { this._dragHandler.enable(); } + //@interlal _cancelOn(domEvent) { const target = domEvent.srcElement || domEvent.target, tagName = target.tagName.toLowerCase(); @@ -643,10 +664,12 @@ class UIMarkerDragHandler extends Handler { return false; } + //@interlal _onMouseDown(param) { stopPropagation(param['domEvent']); } + //@interlal _dragging(param) { const target = this.target, map = target.getMap(), @@ -692,6 +715,7 @@ class UIMarkerDragHandler extends Handler { } + //@interlal _endDrag(param) { const target = this.target, map = target.getMap();