@@ -10,7 +10,7 @@ export class GeoService {
10
10
* If one cluster consists of one coordinate, this coordinate
11
11
* will be returned as it is
12
12
*/
13
- getLocationClusters ( chargingLocations : IChargingLocation [ ] , epsilon : number , idObject ?: { id : number } ) : Promise < ILocationCluster [ ] > {
13
+ getLocationClusters ( chargingLocations : IChargingLocation [ ] , epsilon : number , idObject ?: { id : number } , addGroupCount = false ) : Promise < ILocationCluster [ ] > {
14
14
15
15
return new Promise < ILocationCluster [ ] > ( ( resolve , reject ) => {
16
16
@@ -98,7 +98,7 @@ export class GeoService {
98
98
* coordinates, if list contains only one element,
99
99
* this element will be returned
100
100
*/
101
- private getLocationCluster ( chargingLocations : IChargingLocation [ ] , epsilon : number , idObject ?: { id :number } ) : ILocationCluster {
101
+ private getLocationCluster ( chargingLocations : IChargingLocation [ ] , epsilon : number , idObject ?: { id :number } , addGroupCount = false ) : ILocationCluster {
102
102
103
103
const id = idObject ? idObject . id ++ : null ;
104
104
@@ -138,12 +138,19 @@ export class GeoService {
138
138
let centralSquareRoot = Math . sqrt ( x * x + y * y ) ;
139
139
let centralLatitude = Math . atan2 ( z , centralSquareRoot ) ;
140
140
141
- return {
141
+ const locationCluster : ILocationCluster = {
142
142
id,
143
143
latitude : centralLatitude * 180 / Math . PI ,
144
144
longitude : centralLongitude * 180 / Math . PI ,
145
145
epsilon,
146
146
chargingLocations
147
147
} ;
148
+
149
+ if ( addGroupCount ) {
150
+
151
+ locationCluster . groupCount = total ;
152
+ }
153
+
154
+ return locationCluster ;
148
155
}
149
156
}
0 commit comments