@@ -10,7 +10,7 @@ export class GeoService {
1010 * If one cluster consists of one coordinate, this coordinate
1111 * will be returned as it is
1212 */
13- getLocationClusters ( chargingLocations : IChargingLocation [ ] , epsilon : number , idObject ?: { id : number } ) : Promise < ILocationCluster [ ] > {
13+ getLocationClusters ( chargingLocations : IChargingLocation [ ] , epsilon : number , idObject ?: { id : number } , addGroupCount = false ) : Promise < ILocationCluster [ ] > {
1414
1515 return new Promise < ILocationCluster [ ] > ( ( resolve , reject ) => {
1616
@@ -98,7 +98,7 @@ export class GeoService {
9898 * coordinates, if list contains only one element,
9999 * this element will be returned
100100 */
101- private getLocationCluster ( chargingLocations : IChargingLocation [ ] , epsilon : number , idObject ?: { id :number } ) : ILocationCluster {
101+ private getLocationCluster ( chargingLocations : IChargingLocation [ ] , epsilon : number , idObject ?: { id :number } , addGroupCount = false ) : ILocationCluster {
102102
103103 const id = idObject ? idObject . id ++ : null ;
104104
@@ -138,12 +138,19 @@ export class GeoService {
138138 let centralSquareRoot = Math . sqrt ( x * x + y * y ) ;
139139 let centralLatitude = Math . atan2 ( z , centralSquareRoot ) ;
140140
141- return {
141+ const locationCluster : ILocationCluster = {
142142 id,
143143 latitude : centralLatitude * 180 / Math . PI ,
144144 longitude : centralLongitude * 180 / Math . PI ,
145145 epsilon,
146146 chargingLocations
147147 } ;
148+
149+ if ( addGroupCount ) {
150+
151+ locationCluster . groupCount = total ;
152+ }
153+
154+ return locationCluster ;
148155 }
149156}
0 commit comments