generated from xyy94813/js-lib-template-repo
-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
34 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
import type Marker from './Marker'; | ||
import type Polygon from './Polygon'; | ||
import type Polyline from './Polyline'; | ||
import type { OverlayGroup } from './OverlayGroup'; | ||
|
||
// TODO: 后续考虑是否依赖 @types/geojson | ||
type GeoJSONFeature = Record<string, any>; | ||
type GeoJSONFeatureCollection = Record<string, any>; | ||
|
||
export type GeoJSONOptions = { | ||
/** 目前只支持 GeoJSON.FeatureCollection */ | ||
geoJSON?: GeoJSONFeatureCollection; | ||
getMarker?: (geojsonFeature: GeoJSONFeature, coords: any) => Marker; | ||
getPolyline?: (geojsonFeature: GeoJSONFeature, coords: any) => Polyline; | ||
getPolygon?: (geojsonFeature: GeoJSONFeature, coords: any) => Polygon; | ||
}; | ||
|
||
/** | ||
* GeoJSON类,继承自OverLayGroup,可实现GeoJSON对象与OverlayGroup的相互转换 | ||
* | ||
* @docs https://lbs.amap.com/api/javascript-api-v2/documentation#geojson | ||
*/ | ||
export declare class GeoJSON extends OverlayGroup { | ||
constructor(opt: GeoJSONOptions); | ||
/** 将当前对象包含的覆盖物转换为GeoJSON对象 */ | ||
importData(data: GeoJSONFeatureCollection): void; | ||
/** 将当前对象包含的覆盖物转换为GeoJSON对象 */ | ||
toGeoJSON(): Record<string, any>; | ||
} | ||
|
||
export default GeoJSON; |