-
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.
feat(module:vector-source): add support for components
- heatmap layer - vector image layer - cluster source
- Loading branch information
1 parent
72fbee7
commit 0fb1501
Showing
2 changed files
with
15 additions
and
7 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,23 @@ | ||
import { InjectOptions } from '@angular/core'; | ||
import { useHeatmapLayer } from 'ngx-ol-library/layer/heatmap'; | ||
import { injectVectorLayer } from 'ngx-ol-library/layer/vector'; | ||
import { useVectorImageLayer } from 'ngx-ol-library/layer/vector-image'; | ||
import { useClusterSource } from 'ngx-ol-library/source/cluster'; | ||
|
||
export function injectVectorSourceHost() { | ||
export function useVectorSourceHost() { | ||
const options: InjectOptions = { optional: true, host: true }; | ||
const vectorSourceHost = injectVectorLayer(options); | ||
const vectorLayer = injectVectorLayer(options); | ||
const vectorImageLayer = useVectorImageLayer(options); | ||
const heatmapLayer = useHeatmapLayer(options); | ||
const clusterSource = useClusterSource(options); | ||
const host = clusterSource || heatmapLayer || vectorImageLayer || vectorLayer; | ||
|
||
if (!vectorSourceHost) { | ||
if (!host) { | ||
throw new Error( | ||
'`nol-vector-source` component must be nested within `nol-vector-layer` component.' | ||
'`nol-vector-source` component must be nested within `nol-vector-layer`, ' + | ||
'`nol-heatmap-layer`, `nol-vector-image-layer` or `nol-cluster-source` component.' | ||
); | ||
} | ||
|
||
return vectorSourceHost; | ||
return host; | ||
} |
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