-
Notifications
You must be signed in to change notification settings - Fork 26
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(datasource): add Cluster datasource (#374)
* feat(datasource,layer,style): add Cluster datasource and configurable style for it
- Loading branch information
Showing
14 changed files
with
239 additions
and
83 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
11 changes: 11 additions & 0 deletions
11
packages/geo/src/lib/datasource/shared/datasources/cluster-datasource.interface.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,11 @@ | ||
import olSourceVector from 'ol/source/Vector'; | ||
|
||
import { FeatureDataSource } from './feature-datasource'; | ||
import { FeatureDataSourceOptions } from './feature-datasource.interface'; | ||
|
||
export interface ClusterDataSourceOptions extends FeatureDataSourceOptions { | ||
// type?: 'cluster'; | ||
distance?: number; | ||
source?: FeatureDataSource; | ||
ol?: olSourceVector; | ||
} |
21 changes: 21 additions & 0 deletions
21
packages/geo/src/lib/datasource/shared/datasources/cluster-datasource.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,21 @@ | ||
import olSourceCluster from 'ol/source/Cluster'; | ||
|
||
import { uuid } from '@igo2/utils'; | ||
|
||
import { FeatureDataSource } from './feature-datasource'; | ||
import { ClusterDataSourceOptions } from './cluster-datasource.interface'; | ||
|
||
export class ClusterDataSource extends FeatureDataSource { | ||
public options: ClusterDataSourceOptions; | ||
public ol: olSourceCluster; | ||
|
||
protected createOlSource(): olSourceCluster { | ||
this.options.format = this.getSourceFormatFromOptions(this.options); | ||
this.options.source = super.createOlSource(); | ||
return new olSourceCluster(this.options); | ||
} | ||
|
||
protected generateId() { | ||
return uuid(); | ||
} | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
export interface ClusterParam { | ||
clusterRange?: Array<number>; // utiliser lorsqu'on veux une symbologie active pour une source cluster. | ||
clusterIcon?: string; | ||
clusterScale?: number; | ||
} |
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
Oops, something went wrong.