Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Co-authored-by: 象数 <zhengxue.lzx@antgroup.com> Co-authored-by: yunji <yunji.me@outlook.com>
- Loading branch information
1 parent
3d64017
commit a6ab0c4
Showing
23 changed files
with
686 additions
and
93 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
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
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
17 changes: 17 additions & 0 deletions
17
packages/composite-layers/src/composite-layers/common/constants.ts
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,17 @@ | ||
/** | ||
* 空值 JSON source | ||
*/ | ||
export const EMPTY_JSON_SOURCE = { data: [], parser: { type: 'json', x: 'x', y: 'y' } }; | ||
|
||
/** | ||
* 空值 GEOJSON source | ||
*/ | ||
export const EMPTY_GEOJSON_SOURCE = { | ||
data: { | ||
type: 'FeatureCollection', | ||
features: [], | ||
}, | ||
parser: { type: 'geojson' }, | ||
}; | ||
|
||
export const DEFAULT_HIGHLIGHT_COLOR = '#2f54eb'; |
24 changes: 24 additions & 0 deletions
24
packages/composite-layers/src/composite-layers/common/label-layer.ts
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,24 @@ | ||
import { isUndefined } from '@antv/util'; | ||
import { CompositeLayerOptions } from '../../core/composite-layer'; | ||
import { LabelOptions } from './types'; | ||
|
||
interface WrapLayerOptions extends CompositeLayerOptions { | ||
label?: LabelOptions; | ||
} | ||
|
||
/** | ||
* 获取标注图层配置项 | ||
*/ | ||
export const getLabelLayerOptions = <T extends WrapLayerOptions>(options: T) => { | ||
const { visible, minZoom, maxZoom, zIndex = 0, label } = options; | ||
const labelVisible = visible && Boolean(label) && (isUndefined(label?.visible) || label?.visible); | ||
const labelLayerOptions = { | ||
zIndex: zIndex + 0.1, | ||
minZoom, | ||
maxZoom, | ||
...label, | ||
visible: labelVisible, | ||
}; | ||
|
||
return labelLayerOptions; | ||
}; |
6 changes: 6 additions & 0 deletions
6
packages/composite-layers/src/composite-layers/common/types.ts
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,6 @@ | ||
import { TextLayerOptions } from '../../core-layers/text-layer/types'; | ||
|
||
/** | ||
* 文本标注 | ||
*/ | ||
export type LabelOptions = Omit<TextLayerOptions, 'source'>; |
7 changes: 7 additions & 0 deletions
7
packages/composite-layers/src/composite-layers/icon-layer/adaptor.ts
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,7 @@ | ||
import { isUndefined } from '@antv/util'; | ||
import { DEFAULT_STATE } from './constants'; | ||
import { IconLayerOptions, IconLayerActiveOptions } from './types'; | ||
|
||
export const getDefaultState = (state?: IconLayerOptions['state']) => { | ||
return DEFAULT_STATE; | ||
}; |
Oops, something went wrong.