Commit f79d917b authored by lmj_521aiau@163.com's avatar lmj_521aiau@163.com

no message

parent df107d97
No preview for this file type
......@@ -50,10 +50,11 @@
@property (nonatomic, strong) GMSCircle * selfCircle;
@property (nonatomic, strong) GMSMarker * selfMarker;
@property (nonatomic, assign) float __block zoom;
@property (nonatomic, assign) NSTimer * ttt;
@property (nonatomic, assign) NSInteger tttCount;
@property (nonatomic, strong) GMSPolyline * initialPolyline;
@property (nonatomic, strong) GMSPolyline * actionPolyline;
@property (nonatomic, strong) NSMutableArray * arrayPolylineGreen;
@property (nonatomic, strong) GMSMutablePath * initiallinepath;
@property (nonatomic, strong) GMSMutablePath * actionlinepath;
......@@ -668,42 +669,86 @@
[self.trackTimeView.trackButton setSelected:true];
[self.trackTimeView.trackButton setEnabled:false];
dispatch_source_t timer = dispatch_source_create(DISPATCH_SOURCE_TYPE_TIMER, 0, 0, dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0));
dispatch_source_set_timer(timer, DISPATCH_TIME_NOW, 0.15 * NSEC_PER_SEC, 0 * NSEC_PER_SEC);
dispatch_source_set_event_handler(timer, ^{
// dispatch_source_t timer = dispatch_source_create(DISPATCH_SOURCE_TYPE_TIMER, 0, 0, dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0));
// dispatch_source_set_timer(timer, DISPATCH_TIME_NOW, 0.15 * NSEC_PER_SEC, 0 * NSEC_PER_SEC);
// dispatch_source_set_event_handler(timer, ^{
//
// if (count < self.initiallinepath.count) {
//
// CLLocationCoordinate2D coordinate = [self.initiallinepath coordinateAtIndex:count];
// [self.actionlinepath addCoordinate:coordinate];
//
// GMSCameraPosition *camera = [GMSCameraPosition cameraWithLatitude:coordinate.latitude longitude:coordinate.longitude zoom:20];
//
// self.actionPolyline = [GMSPolyline polylineWithPath:self.actionlinepath];
// self.actionPolyline.strokeColor = [UIColor greenColor];
// self.actionPolyline.strokeWidth = 2;
//
// [CATransaction begin];
// [CATransaction setAnimationDuration:0.14];
//
// self.actionMarker.position = coordinate;
//// self.actionMarker.rotation = location.course
// [self.GGMapView animateToCameraPosition:camera];
// self.actionPolyline.map = self.GGMapView;
// [CATransaction commit];
// count++;
// }else{
// dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
// dispatch_async(dispatch_get_main_queue(), ^{
//
// [self.trackTimeView.trackButton setEnabled:true];
// [self.trackTimeView.trackButton setSelected:false];
// });
// });
// dispatch_source_cancel(timer);
// }
// });
// dispatch_resume(timer);
if (count < self.initiallinepath.count) {
self.tttCount = 0;
_ttt = [NSTimer scheduledTimerWithTimeInterval:0.15 target:self selector:@selector(animate) userInfo:nil repeats:YES];
[[NSRunLoop currentRunLoop] addTimer:_ttt forMode:NSRunLoopCommonModes];
}
CLLocationCoordinate2D coordinate = [self.initiallinepath coordinateAtIndex:count];
[self.actionlinepath addCoordinate:coordinate];
-(void)animate {
GMSCameraPosition *camera = [GMSCameraPosition cameraWithLatitude:coordinate.latitude longitude:coordinate.longitude zoom:20];
dispatch_async(dispatch_get_main_queue(), ^{
if (self.tttCount < self.initiallinepath.count) {
CLLocationCoordinate2D coordinate = [self.initiallinepath coordinateAtIndex:self.tttCount];
[self.actionlinepath addCoordinate:coordinate];
self.actionPolyline = [GMSPolyline polylineWithPath:self.actionlinepath];
self.actionPolyline.strokeColor = [UIColor greenColor];
self.actionPolyline.strokeWidth = 2;
[CATransaction begin];
[CATransaction setAnimationDuration:0.14];
GMSCameraPosition *camera = [GMSCameraPosition cameraWithLatitude:coordinate.latitude longitude:coordinate.longitude zoom:20];
self.actionMarker.position = coordinate;
// self.actionMarker.rotation = location.course
// self.actionMarker.rotation = location.course
[self.GGMapView animateToCameraPosition:camera];
self.actionPolyline.map = self.GGMapView;
[CATransaction commit];
count++;
}else{
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
dispatch_async(dispatch_get_main_queue(), ^{
[self.trackTimeView.trackButton setEnabled:true];
[self.trackTimeView.trackButton setSelected:false];
});
});
dispatch_source_cancel(timer);
self.tttCount++;
// self.actionMarker.map = nil;
// self.actionMarker = [GMSMarker markerWithPosition:[path coordinateAtIndex:self.count]];
// self.actionMarker.icon = [UIImage imageNamed:@"map_track_move_icon"];
// self.actionMarker.title = @"move";
// self.actionMarker.map = self.mapView;
}else {
self.tttCount = 0;
// self.actionMarker.map = nil;
// self.actionlinepath = [[GMSMutablePath alloc] init];
[self.trackTimeView.trackButton setSelected:true];
[self.trackTimeView.trackButton setEnabled:false];
[self.ttt invalidate];
self.ttt = nil;
}
});
dispatch_resume(timer);
}
#pragma mark - GMSMap Delegate google
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment