11import { Component , OnInit , Input , ElementRef , NgZone , ViewChild } from '@angular/core' ;
22import { FormControl , ReactiveFormsModule } from '@angular/forms' ;
3- import { GMapsDirectionsDirective } from 'app/common/states/gmaps.directive' ;
43import { GMapsDirectionsService } from 'app/common/states/gmaps.service' ;
54import { } from '@types/googlemaps' ;
65import { GoogleMapsAPIWrapper , MapsAPILoader } from '@agm/core' ;
@@ -30,7 +29,6 @@ export class TripPlannerComponent implements OnInit {
3029 @ViewChild ( "pickupOutput" )
3130 public pickupOutputElementRef : ElementRef ;
3231
33- @ViewChild ( GMapsDirectionsDirective ) directive : GMapsDirectionsDirective ;
3432 @ViewChild ( GMapsDirectionsService ) service : GMapsDirectionsService ;
3533
3634 constructor (
@@ -39,8 +37,6 @@ export class TripPlannerComponent implements OnInit {
3937 private gmapsApi : GoogleMapsAPIWrapper ,
4038 private _elementRef : ElementRef ) {
4139 }
42- private gmapsApi : GoogleMapsAPIWrapper ,
43- ) { }
4440
4541 ngOnInit ( ) {
4642 //Default Map View
@@ -85,33 +81,24 @@ export class TripPlannerComponent implements OnInit {
8581 return ;
8682 }
8783 if ( inputType === 'pickup' ) {
88- this . directive . origin = { longitude : place . geometry . location . lng ( ) , latitude : place . geometry . location . lat ( ) } ;
89- this . directive . originPlaceId = place . place_id ;
9084 this . service . origin = { longitude : place . geometry . location . lng ( ) , latitude : place . geometry . location . lat ( ) } ;
9185 this . service . originPlaceId = place . place_id ;
9286 } else {
93- this . directive . destination = { longitude : place . geometry . location . lng ( ) , latitude : place . geometry . location . lat ( ) } ;
94- this . directive . destinationPlaceId = place . place_id ;
9587 this . service . destination = { longitude : place . geometry . location . lng ( ) , latitude : place . geometry . location . lat ( ) } ;
9688 this . service . destinationPlaceId = place . place_id ;
9789 }
98- if ( this . directive . directionsDisplay === undefined ) {
9990 if ( this . service . directionsDisplay === undefined ) {
10091 this . mapsAPILoader . load ( ) . then ( ( ) => {
101- this . directive . directionsDisplay = new google . maps . DirectionsRenderer ;
10292 this . service . directionsDisplay = new google . maps . DirectionsRenderer ;
10393 } ) ;
10494 }
105- this . directive . updateDirections ( ) ;
10695 this . service . updateDirections ( ) ;
10796 this . zoom = 12 ;
10897 } ) ;
10998 } ) ;
11099 }
111100
112101 getDistanceAndDuration ( ) {
113- this . estimatedTime = this . directive . estimatedTime ;
114- this . estimatedDistance = this . directive . estimatedDistance ;
115102 this . estimatedTime = this . service . estimatedTime ;
116103 this . estimatedDistance = this . service . estimatedDistance ;
117104 }
0 commit comments