Skip to content

Commit

Permalink
Merge pull request #55 from paulnagle/version_5
Browse files Browse the repository at this point in the history
Map edge cases
  • Loading branch information
paulnagle authored Dec 31, 2023
2 parents c46935a + 98af7e7 commit d5469a6
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 37 deletions.
20 changes: 12 additions & 8 deletions src/app/pages/map-search/map-search.page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,7 @@ export class MapSearchPage implements OnInit {

await GoogleMap.create(mapArgs).then(map => {
this.map = map;
this.map.enableCurrentLocation(true)

this.map.setOnCameraIdleListener((event) => {
if (this.performSearch === false) {
Expand All @@ -149,6 +150,7 @@ export class MapSearchPage implements OnInit {

if (this.currentMarkerIDs.length > 0) {
this.map.removeMarkers(this.currentMarkerIDs).then(result => {
this.currentMarkerIDs = []
this.map.disableClustering().then(clusteringDisabled => {
this.getMeetings(event);
});
Expand All @@ -163,14 +165,18 @@ export class MapSearchPage implements OnInit {
this.openMeetingModal(event.title)
})
}); // create map


}


getMeetings(event: CameraIdleCallbackData) {
this.currentMarkerList = []
this.meetingListService.getRadiusMeetings(event.bounds.center.lat, event.bounds.center.lng, this.mapRadius).then(meetingList => {

// Empty result set edge case
if (meetingList.data =='{}') {
meetingList.data = []
}

meetingList.data = meetingList.data.filter((meeting: { latitude: any }) => meeting.latitude = parseFloat(meeting.latitude));
meetingList.data = meetingList.data.filter((meeting: { longitude: any }) => meeting.longitude = parseFloat(meeting.longitude));
this.currentMeetings = meetingList.data
Expand Down Expand Up @@ -227,9 +233,7 @@ export class MapSearchPage implements OnInit {
lat:this.currentMeetings[i+1]['latitude'],
lng:this.currentMeetings[i+1]['longitude']
}));

console.log("Pushing RED marker")
console.log(this.data)

this.currentMarkerList.push(this.data);
}
}
Expand All @@ -238,6 +242,7 @@ export class MapSearchPage implements OnInit {
});
}


addMarkers() {
if (this.currentMarkerList.length > 0) {
this.map.addMarkers(this.currentMarkerList).then(markerIDs => {
Expand All @@ -251,6 +256,7 @@ export class MapSearchPage implements OnInit {
}
}


meetingsAreCoLocated(i: LatLng, j: LatLng) {
let areColocated = false;
if (((Math.round(i.lat * 1000) / 1000) !== (Math.round(j.lat * 1000) / 1000)) ||
Expand All @@ -264,7 +270,6 @@ export class MapSearchPage implements OnInit {


pushStandaloneMeetingMarker(meeting: any) {
console.log("pushStandaloneMeetingMarker")
let markerLatLng: LatLng = {lat: Number(meeting['latitude']), lng: Number(meeting['longitude'])}
this.data = {
coordinate: markerLatLng,
Expand All @@ -275,8 +280,6 @@ export class MapSearchPage implements OnInit {
y: 100,
}
};
console.log("Standalone meeting marker data")
console.log(this.data)
this.currentMarkerList.push(this.data);
}

Expand Down Expand Up @@ -342,6 +345,7 @@ export class MapSearchPage implements OnInit {
}
}


openMeetingModal(meetingIDs: any) {
console.log(meetingIDs)
this.meetingListService.getMeetingsByIDs(meetingIDs).then((response) => {
Expand Down
30 changes: 1 addition & 29 deletions src/app/services/loading.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ export class LoadingService {
this.isLoading = true;
return await this.loadingController.create({
spinner: 'circles',
backdropDismiss: true,
message: text
}).then(a => {
a.present().then(() => {
Expand All @@ -29,32 +30,3 @@ export class LoadingService {
return await this.loadingController.dismiss();
}
}


// import { Injectable } from '@angular/core';
// import { LoadingController } from '@ionic/angular';

// @Injectable({
// providedIn: 'root'
// })
// export class LoadingService {

// isLoading = false;

// constructor(public loadingController: LoadingController) { }

// async present(text: string) {
// this.isLoading = true;
// const loading = await this.loadingController.create({
// spinner: 'circles',
// message: text
// });

// loading.present();
// }

// async dismiss() {
// this.isLoading = false;
// return await this.loadingController.dismiss();
// }
// }

0 comments on commit d5469a6

Please sign in to comment.