import Class from '../core/Class'; import { BaseEventParamsType } from '../core/Eventable'; import Coordinate from '../geo/Coordinate'; import Point from '../geo/Point'; import Extent from '../geo/Extent'; import PointExtent from '../geo/PointExtent'; import { SizeLike } from '../geo/Size'; import OverlayLayer, { addGeometryFitViewOptions } from '../layer/OverlayLayer'; import type { Map } from '../map'; declare const Geometry_base: { new (...args: any[]): { _jsonType?: string; getJSONType(): string; }; registerJSONType(type: string): void; getJSONClass(type: string): { new (...args: any[]): { _eventMap?: Record; _eventParent?: any; _eventTarget?: any; on(eventsOn: string | import("../core/Eventable").EventRecords, handler: import("../core/Eventable").HandlerFn, context?: any): any; addEventListener(...args: any[]): any; once(eventTypes: string | import("../core/Eventable").EventRecords, handler: import("../core/Eventable").HandlerFn, context?: any): any; off(eventsOff: string | import("../core/Eventable").EventRecords, handler: import("../core/Eventable").HandlerFn, context?: any): any; removeEventListener(...args: any[]): any; listens(eventType: string, handler?: import("../core/Eventable").HandlerFn, context?: any): number; getListeningEvents(): string[]; copyEventListeners(target: any): any; fire(eventType: string, param?: BaseEventParamsType): any; _wrapOnceHandler(evtType: string, handler: import("../core/Eventable").HandlerFn, context?: any): (...args: any[]) => void; _switch(to: string, eventRecords: import("../core/Eventable").EventRecords, context?: any): any; _clearListeners(eventType: string): void; _clearAllListeners(): void; _setEventParent(parent: any): any; _setEventTarget(target: any): any; _fire(eventType: string, param: BaseEventParamsType): any; }; } & { new (...args: any[]): { _handlers?: import("..").Handler[]; addHandler(name: any, handlerClass: any): any; removeHandler(name: any): any; _clearHandlers(): void; }; } & typeof Class; } & { new (...args: any[]): { _eventMap?: Record; _eventParent?: any; _eventTarget?: any; on(eventsOn: string | import("../core/Eventable").EventRecords, handler: import("../core/Eventable").HandlerFn, context?: any): any; addEventListener(...args: any[]): any; once(eventTypes: string | import("../core/Eventable").EventRecords, handler: import("../core/Eventable").HandlerFn, context?: any): any; off(eventsOff: string | import("../core/Eventable").EventRecords, handler: import("../core/Eventable").HandlerFn, context?: any): any; removeEventListener(...args: any[]): any; listens(eventType: string, handler?: import("../core/Eventable").HandlerFn, context?: any): number; getListeningEvents(): string[]; copyEventListeners(target: any): any; fire(eventType: string, param?: BaseEventParamsType): any; _wrapOnceHandler(evtType: string, handler: import("../core/Eventable").HandlerFn, context?: any): (...args: any[]) => void; _switch(to: string, eventRecords: import("../core/Eventable").EventRecords, context?: any): any; _clearListeners(eventType: string): void; _clearAllListeners(): void; _setEventParent(parent: any): any; _setEventTarget(target: any): any; _fire(eventType: string, param: BaseEventParamsType): any; }; } & { new (...args: any[]): { _handlers?: import("..").Handler[]; addHandler(name: any, handlerClass: any): any; removeHandler(name: any): any; _clearHandlers(): void; }; } & typeof Class; /** * 所有几何图形的基类。 * 它定义了所有几何图形类共享的通用方法。 * 它是抽象的,不打算被实例化而是被扩展。 * @english * Base class for all the geometries.
* It defines common methods that all the geometry classes share.
* It is abstract and not intended to be instantiated but extended. * * @category geometry * @abstract * @extends Class * @mixes Eventable * @mixes Handlerable * @mixes JSONAble * @mixes ui.Menuable */ export declare class Geometry extends Geometry_base { options: GeometryOptionsType; type: string; properties: Record; isPoint?: boolean; getHoles?(): Array>; getShell?(): Array; getGeometries?(): Geometry[]; getCoordinates?(): Coordinate | Array | Array> | Array>>; setCoordinates?(coordinate: any): this; onRemove?(): void; getRotateOffsetAngle?(): number; onAdd?(): void; propertiesDirty: boolean; constructor(options: GeometryOptionsType); static fromJSON(json: { [key: string]: any; } | Array<{ [key: string]: any; }>): Geometry | Array; /** * 获取几何图形第一个坐标点 * @english * Returns the first coordinate of the geometry. * * @return {Coordinate} First Coordinate */ getFirstCoordinate(): Coordinate; /** * 获取几何图形最后一个坐标点 * @english * Returns the last coordinate of the geometry. * * @return {Coordinate} Last Coordinate */ getLastCoordinate(): Coordinate; /** * 将几何图形添加到指定图层上 * @english * Adds the geometry to a layer * @param {Layer} layer - layer add to * @param {Boolean} [fitview=false] - automatically set the map to a fit center and zoom for the geometry * @return {Geometry} this * @fires Geometry#add */ addTo(layer: OverlayLayer, fitview?: boolean | addGeometryFitViewOptions): this; /** * 获取几何图形所在的图层 * @english * Get the layer which this geometry added to. * @returns {Layer} - layer added to */ getLayer(): OverlayLayer; /** * 获取几何图形所在的地图对象 * @english * Get the map which this geometry added to * @returns {Map} - map added to */ getMap(): Map | null; /** * 获取几何图形的id * @english * Gets geometry's id. Id is set by setId or constructor options. * @returns {String|Number} geometry的id */ getId(): string; /** * 给几何图形设置id * @english * Set geometry's id. * @param {String} id - new id * @returns {Geometry} this * @fires Geometry#idchange */ setId(id: string): this; /** * 获取几何图形的属性 * @english * Get geometry's properties. Defined by GeoJSON as [feature's properties]{@link http://geojson.org/geojson-spec.html#feature-objects}. * * @returns {Object} properties */ getProperties(): { [key: string]: any; } | null; /** * 给几何图形设置新的属性 * Set a new properties to geometry. * @param {Object} properties - new properties * @returns {Geometry} this * @fires Geometry#propertieschange */ setProperties(properties: { [key: string]: any; }): this; /** * 获取几何图形的类型,例如“点”,"线" * @english * Get type of the geometry, e.g. "Point", "LineString" * @returns {String} type of the geometry */ getType(): string; /** * 获取几何图形的样式 * @english * Get symbol of the geometry * @returns {Object} geometry's symbol */ getSymbol(): any; /** * 给几何图形设置样式 * @english * Set a new symbol to style the geometry. * @param {Object} symbol - new symbol * @see {@tutorial symbol Style a geometry with symbols} * @return {Geometry} this * @fires Geometry#symbolchange */ setSymbol(symbol: any): this; /** * 获取样式的哈希值 * @english * Get symbol's hash code * @return {String} */ getSymbolHash(): string; /** * 更新几何图形当前的样式 * @english * Update geometry's current symbol. * * @param {Object | Array} props - symbol properties to update * @return {Geometry} this * @fires Geometry#symbolchange * @example * var marker = new Marker([0, 0], { * // if has markerFile , the priority of the picture is greater than the vector and the path of svg * // svg image type:'path';vector type:'cross','x','diamond','bar','square','rectangle','triangle','ellipse','pin','pie' * symbol : { * markerType : 'ellipse', * markerWidth : 20, * markerHeight : 30 * } * }); * // update symbol's markerWidth to 40 * marker.updateSymbol({ * markerWidth : 40 * }); */ updateSymbol(props: any): this; /** * 如果几何图形有文本内容,就获取它 * @english * Get geometry's text content if it has * @returns {String} */ getTextContent(): any; getTextDesc(): any; /** * 获取几何图形中心点 * @english * Get the geographical center of the geometry. * * @returns {Coordinate} */ getCenter(): Coordinate; /** * 获取几何图形的包围盒范围 * @english * Get the geometry's geographical extent * * @returns {Extent} geometry's extent */ getExtent(): Extent; /** * 获取几何图形的屏幕像素范围 * @english * Get geometry's screen extent in pixel * * @returns {PointExtent} */ getContainerExtent(out?: PointExtent): PointExtent; get2DExtent(): PointExtent; /** * 获取几何体的像素大小,不同缩放级别的像素大小可能会有所不同。 * @english * Get pixel size of the geometry, which may vary in different zoom levels. * * @returns {Size} */ getSize(): SizeLike; /** * 几何体是否包含输入容器点 * @english * Whehter the geometry contains the input container point. * * @param {Point|Coordinate} point - input container point or coordinate * @param {Number} [t=undefined] - tolerance in pixel * @return {Boolean} * @example * var circle = new Circle([0, 0], 1000) * .addTo(layer); * var contains = circle.containsPoint(new maptalks.Point(400, 300)); */ containsPoint(containerPoint: Point, t?: number): boolean; /** * 显示几何图形 * @english * Show the geometry. * * @return {Geometry} this * @fires Geometry#show */ show(): this; /** * 隐藏几何图形 * @english * Hide the geometry * * @return {Geometry} this * @fires Geometry#hide */ hide(): this; /** * 几何图形是否可见 * @english * Whether the geometry is visible * * @returns {Boolean} */ isVisible(): boolean; /** * symbol是否可见 * @english * Whether the geometry symbol is visible * * @returns {Boolean} */ symbolIsVisible(): boolean; /** * 获取几何图形所在层级,默认是0 * @english * Get zIndex of the geometry, default is 0 * @return {Number} zIndex */ getZIndex(): number; /** * 给几何图形设置新的层级并触发zindexchange事件(将导致层对几何体进行排序并进行渲染) * @english * Set a new zIndex to Geometry and fire zindexchange event (will cause layer to sort geometries and render) * @param {Number} zIndex - new zIndex * @return {Geometry} this * @fires Geometry#zindexchange */ setZIndex(zIndex: number): this; /** * 仅将新的zIndex设置为Geometry,而不触发zindexchange事件 * 当需要更新许多几何图形的zIndex时,可以用来提高性能 * 当更新了N个几何体时,可以将setZIndexSilently与(N-1)个几何体一起使用,并将setZIendex与要排序和渲染的层的最后一个几何体一同使用。 * @english * Only set a new zIndex to Geometry without firing zindexchange event.
* Can be useful to improve perf when a lot of geometries' zIndex need to be updated.
* When updated N geometries, You can use setZIndexSilently with (N-1) geometries and use setZIndex with the last geometry for layer to sort and render. * @param {Number} zIndex - new zIndex * @return {Geometry} this */ setZIndexSilently(zIndex: number): this; /** * 将几何图形至于顶层 * @english * Bring the geometry on the top * @return {Geometry} this * @fires Geometry#zindexchange */ bringToFront(): this; /** * 将几何图形置于底层 * @english * Bring the geometry to the back * @return {Geometry} this * @fires Geometry#zindexchange */ bringToBack(): this; /** * 按给定偏移平移或移动几何体 * @english * Translate or move the geometry by the given offset. * * @param {Coordinate} offset - translate offset * @return {Geometry} this * @fires Geometry#positionchange * @fires Geometry#shapechange */ /** * Translate or move the geometry by the given offset. * * @param {Number} x - x offset * @param {Number} y - y offset * @param {Number} z - z offset * @return {Geometry} this * @fires Geometry#positionchange * @fires Geometry#shapechange */ translate(x: number | Coordinate, y?: number, z?: number): this; _translateRotatePivot(newCoordinate: Coordinate): this; /** * 闪烁几何图形,按一定的内部显示和隐藏计数次数。 * @english * Flash the geometry, show and hide by certain internal for times of count. * * @param {Number} [interval=100] - interval of flash, in millisecond (ms) * @param {Number} [count=4] - flash times * @param {Function} [cb=null] - callback function when flash ended * @param {*} [context=null] - callback context * @return {Geometry} this */ flash(interval: number, count: number, cb: () => void, context: any): this; /** * 返回不包含事件侦听器的几何体的副本。 * @english * Returns a copy of the geometry without the event listeners. * @returns {Geometry} copy */ copy(): Geometry; /** * 将其自身从图层中移除(如果有的话)。 * @english * remove itself from the layer if any. * @returns {Geometry} this * @fires Geometry#removestart * @fires Geometry#remove */ remove(): this; /** * 将几何对象导出成geojson对象 * @english * Exports [geometry]{@link http://geojson.org/geojson-spec.html#feature-objects} out of a GeoJSON feature. * @return {Object} GeoJSON Geometry */ toGeoJSONGeometry(): { [key: string]: any; }; /** * 导出geojson对象中的一个feature * @english * Exports a GeoJSON feature. * @param {Object} [opts=null] - export options * @param {Boolean} [opts.geometry=true] - whether export geometry * @param {Boolean} [opts.properties=true] - whether export properties * @returns {Object} GeoJSON Feature */ toGeoJSON(opts?: { [key: string]: any; }): { [key: string]: any; }; /** * 从几何体中导出一个配置文件json。 * 除了导出特性对象,概要文件json还包含符号、构造选项和信息窗口信息。 * 配置文件json可以存储在其他地方,稍后用于重现几何图形 * 由于函数的序列化问题,概要文件json中不包括事件侦听器和上下文菜单 * @english * Export a profile json out of the geometry.
* Besides exporting the feature object, a profile json also contains symbol, construct options and infowindow info.
* The profile json can be stored somewhere else and be used to reproduce the geometry later.
* Due to the problem of serialization for functions, event listeners and contextmenu are not included in profile json. * @example * // an example of a profile json. * var profile = { "feature": { "type": "Feature", "id" : "point1", "geometry": {"type": "Point", "coordinates": [102.0, 0.5]}, "properties": {"prop0": "value0"} }, //construct options. "options":{ "draggable" : true }, //symbol "symbol":{ "markerFile" : "http://foo.com/icon.png", "markerWidth" : 20, "markerHeight": 20 }, //infowindow info "infowindow" : { "options" : { "style" : "black" }, "title" : "this is a infowindow title", "content" : "this is a infowindow content" } }; * @param {Object} [options=null] - export options * @param {Boolean} [opts.geometry=true] - whether export feature's geometry * @param {Boolean} [opts.properties=true] - whether export feature's properties * @param {Boolean} [opts.options=true] - whether export construct options * @param {Boolean} [opts.symbol=true] - whether export symbol * @param {Boolean} [opts.infoWindow=true] - whether export infowindow * @return {Object} profile json object */ toJSON(options?: { [key: string]: any; }): { [key: string]: any; }; /** * 获取几何图形的地理长度 * @english * Get the geographic length of the geometry. * @returns {Number} geographic length, unit is meter */ getLength(): number; /** * 获取几何图形的面积 * @english * Get the geographic area of the geometry. * @returns {Number} geographic area, unit is sq.meter */ getArea(): number; /** * 按给定角度围绕轴心点旋转几何体 * @english * Rotate the geometry of given angle around a pivot point * @param {Number} angle - angle to rotate in degree * @param {Coordinate} [pivot=null] - optional, will be the geometry's center by default * @returns {Geometry} this */ rotate(angle: number, pivot?: Coordinate): this; isRotated(): boolean; onHide(): void; onShapeChanged(): void; onPositionChanged(): void; onSymbolChanged(): void; onConfig(conf: any): void; getAltitude(): number | number[] | number[][]; hasAltitude(): boolean; setAltitude(alt: number): this; getMinAltitude(): number; getMaxAltitude(): number; } export type GeometryOptionsType = { id?: string; visible?: boolean; interactive?: boolean; editable?: boolean; cursor?: string; antiMeridian?: boolean; defaultProjection?: string; measure?: string; draggable?: boolean; dragShadow?: boolean; dragOnAxis?: string; dragOnScreenAxis?: boolean; zIndex?: number; symbol?: any; properties?: { [key: string]: any; }; rotateAngle?: number; rotatePivot?: Array; }; export default Geometry; //# sourceMappingURL=Geometry.d.ts.map