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

no message

parent 99dad828
No preview for this file type
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1150"
version = "1.3">
version = "1.7">
<BuildAction
parallelizeBuildables = "YES"
buildImplicitDependencies = "YES">
......@@ -39,7 +39,7 @@
ignoresPersistentStateOnLaunch = "NO"
debugDocumentVersioning = "YES"
debugServiceExtension = "internal"
allowLocationSimulation = "YES">
allowLocationSimulation = "NO">
<BuildableProductRunnable
runnableDebuggingMode = "0">
<BuildableReference
......@@ -50,6 +50,10 @@
ReferencedContainer = "container:ZhiJi.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
<LocationScenarioReference
identifier = "com.apple.dt.IDEFoundation.CurrentLocationScenarioIdentifier"
referenceType = "1">
</LocationScenarioReference>
</LaunchAction>
<ProfileAction
buildConfiguration = "Release"
......
......@@ -8,6 +8,7 @@
#import "ZJBaseMapViewController.h"
#import <GoogleMaps/GoogleMaps.h>
#import "ZJLocationManager.h"
@interface ZJBaseMapViewController ()<MAMapViewDelegate, XMPopupListViewDelegate, GMSMapViewDelegate>
......@@ -20,7 +21,11 @@
@property (nonatomic, strong) ZJMapCardFriendSelectView *selectView;
@property (nonatomic, strong) ZJFriendModel *selectFriendModel;
@property (nonatomic, strong) GMSMapView *mapView;
@property (nonatomic, strong) GMSMapView * mapView;
@property (nonatomic, strong) GMSMarker * selfMarker;
@property (nonatomic, assign) float zoom;
@property (nonatomic, assign) BOOL refershMyself;
@end
......@@ -43,6 +48,19 @@
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(2 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
// [self getFriendList];
});
self.refershMyself = YES;
[[ZJLocationManager shared] initWithLocationUpdateInfo:^(ZJLocationModel * model, CLLocation * location) {
CLLocationCoordinate2D coord = CLLocationCoordinate2DMake(model.latitude, model.longitude);
if (self.refershMyself) {
self.mapView.camera = [GMSCameraPosition cameraWithTarget:coord zoom:self.zoom];
self.refershMyself = NO;
}
[self setPoint:coord target:1];
}];
}
- (void)viewWillAppear:(BOOL)animated{
......@@ -54,6 +72,8 @@
GMSCameraPosition *camera = [GMSCameraPosition cameraWithLatitude:-33.868 longitude:151.2086 zoom:12];
_zoom = 14;
///初始化地图
// self.mapView = [[MAMapView alloc] initWithFrame:self.view.bounds];
self.mapView = [GMSMapView mapWithFrame:self.view.bounds camera:camera];
......@@ -72,7 +92,7 @@
// [self.mapView performSelector:NSSelectorFromString(@"setMapLanguage:") withObject:@(1)];
// }
// _mapView.delegate = self;
_mapView.delegate = self;
// _mapView.zoomLevel = 14;
// _mapView.showsScale = false;
// _mapView.showsCompass = false;
......@@ -132,11 +152,29 @@
};
}
- (void)setPoint:(CLLocationCoordinate2D)point{
CLLocationCoordinate2D position = point;
GMSMarker *marker = [GMSMarker markerWithPosition:position];
marker.title = @"Hello World";
marker.map = _mapView;
- (void)setPoint:(CLLocationCoordinate2D)point target:(NSInteger)target{
if (target == 1) {
CLLocationCoordinate2D position = point;
_selfMarker.map = nil;
_selfMarker = [GMSMarker markerWithPosition:position];
// _selfMarker.appearAnimation = kGMSMarkerAnimationPop;
// _selfMarker.icon = [GMSMarker markerImageWithColor:[UIColor blackColor]];
_selfMarker.icon = [UIImage imageNamed:@"map_track_srart_end_icon"];
_selfMarker.tracksInfoWindowChanges = YES;
_selfMarker.title = @"Me";
_selfMarker.snippet = @"WTF";
_selfMarker.infoWindowAnchor = CGPointMake(0.5, 0.25);
_selfMarker.map = _mapView;
}else{
CLLocationCoordinate2D position = point;
GMSMarker *marker = [GMSMarker markerWithPosition:position];
marker.title = @"Hello World";
marker.map = _mapView;
}
}
-(void)mapView:(GMSMapView*)mapView idleAtCameraPosition:(GMSCameraPosition*)position{
_zoom = position.zoom;
}
- (void)mapView:(UIView *)mapView regionDidChangeAnimated:(BOOL)animated {
......
......@@ -18,10 +18,12 @@
#import "AlertControllerTool.h"
#import <CoreLocation/CoreLocation.h>
#import "BaseWebViewController.h"
#import <GoogleMaps/GoogleMaps.h>
#import "ZJLocationManager.h"
@interface ZJFriendTrackMapViewController () <MAMapViewDelegate>
@interface ZJFriendTrackMapViewController () <MAMapViewDelegate, GMSMapViewDelegate>
@property (nonatomic, strong) MAMapView *mapView;
//@property (nonatomic, strong) MAMapView *mapView;
@property (nonatomic, strong) UIButton *gpsButton;
@property (nonatomic, strong) ZJUserTrackTimeView *trackTimeView;
@property (nonatomic, strong) NSMutableArray<ZJLocationModel *> *locations;
......@@ -36,6 +38,29 @@
@property (nonatomic, strong) NSArray *distanceArray;
@property (nonatomic, assign) double sumDistance;
@property (nonatomic, strong) ZJAlertView *alertView;
@property (nonatomic, strong) GMSMapView * mapView;
@property (nonatomic, strong) GMSCircle * selfCircle;
@property (nonatomic, strong) GMSMarker * selfMarker;
@property (nonatomic, assign) float __block zoom;
@property (nonatomic, assign) BOOL refershMyself;
@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;
@property (nonatomic, strong) GMSMarker * startMarker;
@property (nonatomic, strong) GMSMarker * endMarker;
@property (nonatomic, strong) GMSMarker * actionMarker;
@property (nonatomic, assign) NSInteger count;
@property(nonatomic, retain) NSTimer * timer;
@end
@implementation ZJFriendTrackMapViewController
......@@ -69,6 +94,23 @@
}
}
- (void)viewDidAppear:(BOOL)animated {
[super viewDidAppear:animated];
self.refershMyself = YES;
[[ZJLocationManager shared] initWithLocationUpdateInfo:^(ZJLocationModel * model, CLLocation * location) {
CLLocationCoordinate2D coord = CLLocationCoordinate2DMake(model.latitude, model.longitude);
if (self.refershMyself) {
self.mapView.camera = [GMSCameraPosition cameraWithTarget:coord zoom:self.zoom];
self.refershMyself = NO;
}
[self setPoint:coord target:1];
}];
}
-(void)shareAction {
//share
}
......@@ -136,19 +178,24 @@
- (void)setupUI {
_zoom = 20;
GMSCameraPosition *camera = [GMSCameraPosition cameraWithLatitude:-33.868 longitude:151.2086 zoom:_zoom];
///初始化地图
self.mapView = [[MAMapView alloc] initWithFrame:self.view.bounds];
// self.mapView = [[MAMapView alloc] initWithFrame:self.view.bounds];
self.mapView = [GMSMapView mapWithFrame:self.view.bounds camera:camera];
_mapView.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;
///把地图添加至view
[self.view addSubview: _mapView];
///如果您需要进入地图就显示定位小蓝点,则需要下面两行代码
_mapView.showsUserLocation = false;
// _mapView.showsUserLocation = false;
_mapView.delegate = self;
_mapView.zoomLevel = 14;
_mapView.showsScale = false;
_mapView.showsCompass = false;
// _mapView.zoomLevel = 14;
// _mapView.showsScale = false;
// _mapView.showsCompass = false;
// 添加 card view
self.trackTimeView = [[[NSBundle mainBundle] loadNibNamed:@"ZJUserTrackTimeView" owner:self options:nil] lastObject];
......@@ -177,94 +224,293 @@
weakSelf.endDate = endDate;
};
self.track = [[MAAnimatedAnnotation alloc] init];
self.track.title = @"pointReuseIndetifier1";
[self.mapView addAnnotation:self.track];
// self.track = [[MAAnimatedAnnotation alloc] init];
// self.track.title = @"pointReuseIndetifier1";
// [self.mapView addAnnotation:self.track];
_initialPolyline = [[GMSPolyline alloc] init];
_initiallinepath = [GMSMutablePath path];
}
- (void) drawLineAction {
if (self.isMyTrack) {
[MobClick event:@"mytrack_querybutton_click"];
- (void)setPoint:(CLLocationCoordinate2D)point target:(NSInteger)target{
if (target == 1) {
CLLocationCoordinate2D position = point;
_selfMarker.map = nil;
_selfMarker = [GMSMarker markerWithPosition:position];
// _selfMarker.appearAnimation = kGMSMarkerAnimationPop;
// _selfMarker.icon = [GMSMarker markerImageWithColor:[UIColor blackColor]];
_selfMarker.icon = [UIImage imageNamed:@"map_track_srart_end_icon"];
_selfMarker.tracksInfoWindowChanges = YES;
_selfMarker.title = @"Me";
_selfMarker.snippet = @"WTF";
_selfMarker.infoWindowAnchor = CGPointMake(0.5, 0.25);
_selfMarker.map = _mapView;
CLLocationDistance distance = 100;
self.selfCircle.map = nil;
self.selfCircle = [GMSCircle circleWithPosition:position radius:distance];
self.selfCircle.fillColor = [kColorWithRGBA(86, 142, 252, 0.15) colorWithAlphaComponent:0.5];
self.selfCircle.strokeColor = [kColorWithRGBA(86, 142, 252, 0.6) colorWithAlphaComponent:0.5];
self.selfCircle.strokeWidth = 1.0;
self.selfCircle.map = self.mapView;
}else{
[MobClick event:@"friendtrack_querybutton_click"];
CLLocationCoordinate2D position = point;
GMSMarker *marker = [GMSMarker markerWithPosition:position];
marker.title = @"Hello World";
marker.map = _mapView;
}
}
[self.trackTimeView.trackButton setSelected:true];
[self.trackTimeView.trackButton setEnabled:false];
//移除
[self.mapView removeOverlay:self.commonPolyline];
// need get user location info
if ([CLLocationManager locationServicesEnabled] && ([CLLocationManager authorizationStatus] == kCLAuthorizationStatusAuthorizedWhenInUse || [CLLocationManager authorizationStatus] == kCLAuthorizationStatusNotDetermined || [CLLocationManager authorizationStatus] == kCLAuthorizationStatusAuthorized)) {
// do nothing
} else if ([CLLocationManager authorizationStatus] ==kCLAuthorizationStatusDenied) {
//定位不能用
[AlertControllerTool alertControllerWithTitle:kLocalizedString(@"alert_location_switch") message:kLocalizedString(@"alert_location_service") cancelTitle:kLocalizedString(@"alert_cancel") cancelBlock:^{
} confirm:kLocalizedString(@"alert_setting") confirmBlock:^(id s) {
NSURL * url = [NSURL URLWithString:UIApplicationOpenSettingsURLString];
if([[UIApplication sharedApplication] canOpenURL:url]) {
if (@available(iOS 10.0, *)) {
[[UIApplication sharedApplication] openURL:url options:@{} completionHandler:nil];
}else{
[[UIApplication sharedApplication] openURL:url];
}
}
} finishBlock:nil];
return;
-(void)mapView:(GMSMapView*)mapView idleAtCameraPosition:(GMSCameraPosition*)position{
_zoom = position.zoom;
}
//画线,使用轨迹回放
- (void)drawLineWithLocationArray:(NSArray *)locationArray{
_initialPolyline.map = nil;
_initialPolyline.strokeColor = [UIColor blueColor];
_initialPolyline.strokeWidth = 2.f;
CLLocationCoordinate2D startCoordinate;
CLLocationCoordinate2D endCoordinate;
for(int idx = 0; idx < locationArray.count; idx++)
{
ZJLocationModel * model = [locationArray objectAtIndex:idx];
CLLocation *location = [[CLLocation alloc] initWithLatitude:model.latitude longitude:model.longitude];
// CLLocation *location = [locationArray objectAtIndex:idx];
CLLocationDegrees latitude = location.coordinate.latitude;
CLLocationDegrees longitude = location.coordinate.longitude;
// create our coordinate and add it to the correct spot in the array
CLLocationCoordinate2D coordinate = CLLocationCoordinate2DMake(latitude, longitude);
[_initiallinepath addCoordinate:coordinate];
if (idx == 0) {
startCoordinate = coordinate;
}
if (idx == locationArray.count-1){
endCoordinate = coordinate;
}
}
MAPointAnnotation *pointAnnotation1 = [[MAPointAnnotation alloc] init];
pointAnnotation1.coordinate = CLLocationCoordinate2DMake(self.locations.firstObject.latitude, self.locations.firstObject.longitude);
pointAnnotation1.title = @"start";
[self.mapView addAnnotation:pointAnnotation1];
_initialPolyline.path = _initiallinepath;
_initialPolyline.map = _mapView;
_startMarker.map = nil;
_startMarker = [GMSMarker markerWithPosition:startCoordinate];
_startMarker.appearAnimation = kGMSMarkerAnimationPop;
_startMarker.icon = [UIImage imageNamed:@"map_track_start_icon"];
_startMarker.title = @"start";
_startMarker.map = _mapView;
//构造折线数据对象
CLLocationCoordinate2D commonPolylineCoords[self.locations.count];
_endMarker.map = nil;
_endMarker = [GMSMarker markerWithPosition:endCoordinate];
_endMarker.appearAnimation = kGMSMarkerAnimationPop;
_endMarker.icon = [UIImage imageNamed:@"map_track_end_icon"];
_endMarker.title = @"end";
_endMarker.map = _mapView;
for (int i = 0 ; i < self.locations.count; i++) {
commonPolylineCoords[i].latitude = self.locations[i].latitude;
commonPolylineCoords[i].longitude = self.locations[i].longitude;
for(int idx = 0; idx < self.initiallinepath.count; idx++){
}
MAPointAnnotation *pointAnnotation2 = [[MAPointAnnotation alloc] init];
pointAnnotation2.coordinate = CLLocationCoordinate2DMake(self.locations.lastObject.latitude, self.locations.lastObject.longitude);
pointAnnotation2.title = @"end";
[self.mapView addAnnotation:pointAnnotation2];
//构造折线对象
MAPolyline *commonPolyline = [MAPolyline polylineWithCoordinates:commonPolylineCoords count:self.locations.count];
self.commonPolyline = commonPolyline;
// self.commonPolyline.boundingMapRect
//在地图上添加折线对象
[self.mapView addOverlay: commonPolyline];
int count = sizeof(commonPolylineCoords) / sizeof(commonPolylineCoords[0]);
self.mapView.centerCoordinate = commonPolylineCoords[count/2];
double sum = 0;
NSMutableArray *arr = [NSMutableArray arrayWithCapacity:count];
for(int i = 0; i < count - 1; ++i) {
CLLocation *begin = [[CLLocation alloc] initWithLatitude:commonPolylineCoords[i].latitude longitude:commonPolylineCoords[i].longitude];
CLLocation *end = [[CLLocation alloc] initWithLatitude:commonPolylineCoords[i+1].latitude longitude:commonPolylineCoords[i+1].longitude];
CLLocationDistance distance = [end distanceFromLocation:begin];
[arr addObject:[NSNumber numberWithDouble:distance]];
sum += distance;
// self.actionMarker.map = nil;
// self.actionMarker = [GMSMarker markerWithPosition:startCoordinate];
// self.actionMarker.icon = [UIImage imageNamed:@"map_track_move_icon"];
// self.actionMarker.title = @"move";
// self.actionMarker.map = self.mapView;
// [self.actionMarker.layer addSublayer: ];
// [self haha:[self hehe]];
_actionlinepath = [GMSMutablePath path];
_count = 0;
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.3 * NSEC_PER_SEC, 0 * NSEC_PER_SEC);
dispatch_source_set_event_handler(timer, ^{
if (self.count < self.initiallinepath.count) {
CLLocationCoordinate2D coordinate = [self.initiallinepath coordinateAtIndex:self.count];
[self.actionlinepath addCoordinate:coordinate];
self.actionPolyline = [GMSPolyline polylineWithPath:self.actionlinepath];
self.actionPolyline.strokeColor = [UIColor greenColor];
self.actionPolyline.strokeWidth = 2;
// [CATransaction begin];
// [CATransaction setAnimationDuration:0.1];
self.actionPolyline.map = self.mapView;
// [CATransaction commit];
self.count++;
}else{
dispatch_source_cancel(timer);
}
});
dispatch_resume(timer);
}
-(void)addMarkers:(GMSPath *)path{
}
- (CAShapeLayer *)hehe{
UIBezierPath *breizerPath = [UIBezierPath bezierPath];
for(int i = 0; i < self.initiallinepath.count; i++){
CLLocationCoordinate2D coordinate = [self.initiallinepath coordinateAtIndex:i];
[breizerPath addLineToPoint:[_mapView.projection pointForCoordinate:coordinate]];
}
self.distanceArray = arr;
self.sumDistance = sum;
CAShapeLayer *shapeLayer = [CAShapeLayer layer];
shapeLayer.path = [[breizerPath bezierPathByReversingPath] CGPath];
shapeLayer.strokeColor = [[UIColor redColor] CGColor];
shapeLayer.lineWidth = 1.0;
shapeLayer.fillColor = [[UIColor redColor] CGColor];
shapeLayer.lineJoin = kCALineJoinRound;
shapeLayer.lineCap = kCALineCapRound;
shapeLayer.cornerRadius = 5;
double speed_car1 = self.sumDistance / 12; //80 km/h
// int count1 = sizeof(commonPolylineCoords) / sizeof(commonPolylineCoords[0]);
[self.track setCoordinate:commonPolylineCoords[0]];
__weak typeof(self) weakSelf = self;
[self.track addMoveAnimationWithKeyCoordinates:commonPolylineCoords count:count withDuration:self.sumDistance / speed_car1 withName:nil completeCallback:^(BOOL isFinished) {
[weakSelf.trackTimeView.trackButton setEnabled:true];
[weakSelf.trackTimeView.trackButton setSelected:false];
}];
[self.mapView setVisibleMapRect:self.commonPolyline.boundingMapRect edgePadding:UIEdgeInsetsMake(250, 50, 50, 50) animated:true];
return shapeLayer;
}
- (void)haha:(CAShapeLayer *)layer{
CABasicAnimation *pathAnimation = [CABasicAnimation animationWithKeyPath:@"strokeEnd"];
pathAnimation.duration = 10;
// pathAnimation.delegate = self;
[pathAnimation setTimingFunction:[CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseOut]];
pathAnimation.fromValue = [NSNumber numberWithFloat:0.0f];
pathAnimation.toValue = [NSNumber numberWithFloat:1.0f];
pathAnimation.repeatCount = 100;
[layer addAnimation:pathAnimation forKey:@"strokeEnd"];
[self.mapView.layer addSublayer:layer];
}
-(void)animate:(GMSPath *)path {
// for(int idx = 0; idx < path.count; idx++){
//
// }
dispatch_async(dispatch_get_main_queue(), ^{
if (self.count < path.count) {
[self.actionlinepath addCoordinate:[path coordinateAtIndex:self.count]];
self.actionPolyline = [GMSPolyline polylineWithPath:self.actionlinepath];
self.actionPolyline.strokeColor = [UIColor greenColor];
self.actionPolyline.strokeWidth = 2;
self.actionPolyline.map = self.mapView;
[self.arrayPolylineGreen addObject:self.actionPolyline];
self.count++;
// 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.count = 0;
self.actionMarker.map = nil;
self.actionlinepath = [[GMSMutablePath alloc] init];
for (GMSPolyline *line in self.arrayPolylineGreen) {
line.map = nil;
}
}
});
}
//- (void) drawLineAction {
//
// if (self.isMyTrack) {
// [MobClick event:@"mytrack_querybutton_click"];
// }else{
// [MobClick event:@"friendtrack_querybutton_click"];
// }
//
// [self.trackTimeView.trackButton setSelected:true];
// [self.trackTimeView.trackButton setEnabled:false];
// //移除
// [self.mapView removeOverlay:self.commonPolyline];
//
// // need get user location info
// if ([CLLocationManager locationServicesEnabled] && ([CLLocationManager authorizationStatus] == kCLAuthorizationStatusAuthorizedWhenInUse || [CLLocationManager authorizationStatus] == kCLAuthorizationStatusNotDetermined || [CLLocationManager authorizationStatus] == kCLAuthorizationStatusAuthorized)) {
// // do nothing
// } else if ([CLLocationManager authorizationStatus] ==kCLAuthorizationStatusDenied) {
// //定位不能用
// [AlertControllerTool alertControllerWithTitle:kLocalizedString(@"alert_location_switch") message:kLocalizedString(@"alert_location_service") cancelTitle:kLocalizedString(@"alert_cancel") cancelBlock:^{
// } confirm:kLocalizedString(@"alert_setting") confirmBlock:^(id s) {
// NSURL * url = [NSURL URLWithString:UIApplicationOpenSettingsURLString];
// if([[UIApplication sharedApplication] canOpenURL:url]) {
// if (@available(iOS 10.0, *)) {
// [[UIApplication sharedApplication] openURL:url options:@{} completionHandler:nil];
// }else{
// [[UIApplication sharedApplication] openURL:url];
// }
// }
// } finishBlock:nil];
// return;
// }
// MAPointAnnotation *pointAnnotation1 = [[MAPointAnnotation alloc] init];
// pointAnnotation1.coordinate = CLLocationCoordinate2DMake(self.locations.firstObject.latitude, self.locations.firstObject.longitude);
// pointAnnotation1.title = @"start";
// [self.mapView addAnnotation:pointAnnotation1];
//
// //构造折线数据对象
// CLLocationCoordinate2D commonPolylineCoords[self.locations.count];
//
// for (int i = 0 ; i < self.locations.count; i++) {
// commonPolylineCoords[i].latitude = self.locations[i].latitude;
// commonPolylineCoords[i].longitude = self.locations[i].longitude;
// }
//
// MAPointAnnotation *pointAnnotation2 = [[MAPointAnnotation alloc] init];
// pointAnnotation2.coordinate = CLLocationCoordinate2DMake(self.locations.lastObject.latitude, self.locations.lastObject.longitude);
// pointAnnotation2.title = @"end";
// [self.mapView addAnnotation:pointAnnotation2];
//
// //构造折线对象
// MAPolyline *commonPolyline = [MAPolyline polylineWithCoordinates:commonPolylineCoords count:self.locations.count];
// self.commonPolyline = commonPolyline;
//// self.commonPolyline.boundingMapRect
// //在地图上添加折线对象
// [self.mapView addOverlay: commonPolyline];
//
// int count = sizeof(commonPolylineCoords) / sizeof(commonPolylineCoords[0]);
// self.mapView.centerCoordinate = commonPolylineCoords[count/2];
// double sum = 0;
// NSMutableArray *arr = [NSMutableArray arrayWithCapacity:count];
// for(int i = 0; i < count - 1; ++i) {
// CLLocation *begin = [[CLLocation alloc] initWithLatitude:commonPolylineCoords[i].latitude longitude:commonPolylineCoords[i].longitude];
// CLLocation *end = [[CLLocation alloc] initWithLatitude:commonPolylineCoords[i+1].latitude longitude:commonPolylineCoords[i+1].longitude];
// CLLocationDistance distance = [end distanceFromLocation:begin];
// [arr addObject:[NSNumber numberWithDouble:distance]];
// sum += distance;
// }
//
// self.distanceArray = arr;
// self.sumDistance = sum;
//
// double speed_car1 = self.sumDistance / 12; //80 km/h
// // int count1 = sizeof(commonPolylineCoords) / sizeof(commonPolylineCoords[0]);
// [self.track setCoordinate:commonPolylineCoords[0]];
// __weak typeof(self) weakSelf = self;
// [self.track addMoveAnimationWithKeyCoordinates:commonPolylineCoords count:count withDuration:self.sumDistance / speed_car1 withName:nil completeCallback:^(BOOL isFinished) {
// [weakSelf.trackTimeView.trackButton setEnabled:true];
// [weakSelf.trackTimeView.trackButton setSelected:false];
// }];
// [self.mapView setVisibleMapRect:self.commonPolyline.boundingMapRect edgePadding:UIEdgeInsetsMake(250, 50, 50, 50) animated:true];
//
//}
- (ZJAlertView *)getAlertView:(NSString *)title subtitle:(NSString *)subtitle leftButtonTitle:(NSString *)leftButtonTitle rightButtonTitle:(NSString *)rightButtonTitle {
ZJAlertView* alertView = [[[NSBundle mainBundle]loadNibNamed:@"ZJAlertView" owner:self options:nil]lastObject];
alertView.frame = CGRectMake(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT);
......@@ -372,14 +618,14 @@
if ([ZJUserInfoManager shared].uid.length <= 0) {
///如果您需要进入地图就显示定位小蓝点,则需要下面两行代码
self.mapView.showsUserLocation = YES;
self.mapView.userTrackingMode = MAUserTrackingModeFollow;
// self.mapView.showsUserLocation = YES;
// self.mapView.userTrackingMode = MAUserTrackingModeFollow;
return;
}
if ([ZJUserInfoManager shared].token.length <= 0) {
///如果您需要进入地图就显示定位小蓝点,则需要下面两行代码
self.mapView.showsUserLocation = YES;
self.mapView.userTrackingMode = MAUserTrackingModeFollow;
// self.mapView.showsUserLocation = YES;
// self.mapView.userTrackingMode = MAUserTrackingModeFollow;
return;
}
......@@ -425,7 +671,8 @@
// [MBProgressHUD showMessage:kLocalizedString(@"track_friend_timeWithin_no_location")];
return;
}
[_self drawLineAction];
// [_self drawLineAction];
[_self drawLineWithLocationArray:_self.locations];
}else if ([[response objectForKey:@"status"] integerValue] == 105) {
[MBProgressHUD showError:[response objectForKey:@"msg"] toView:self.view];
}
......@@ -433,7 +680,6 @@
} failure:^(NSError * _Nonnull error) {
NSLog(@"失败");
}];
}
#pragma mark 获取最后一次位置
......@@ -442,8 +688,8 @@
NSLog(@"%@", [ZJUserInfoManager shared].uid);
if ([ZJUserInfoManager shared].uid.length <= 0 || ![ZJUserInfoManager shared].isMember) {
///如果您需要进入地图就显示定位小蓝点,则需要下面两行代码
self.mapView.showsUserLocation = YES;
self.mapView.userTrackingMode = MAUserTrackingModeFollow;
// self.mapView.showsUserLocation = YES;
// self.mapView.userTrackingMode = MAUserTrackingModeFollow;
return;
}
__weak typeof(self) _self = self;
......@@ -451,8 +697,8 @@
NSString *uid = self.model.friendUid;
if (uid.length <= 0) {
///如果您需要进入地图就显示定位小蓝点,则需要下面两行代码
self.mapView.showsUserLocation = YES;
self.mapView.userTrackingMode = MAUserTrackingModeFollow;
// self.mapView.showsUserLocation = YES;
// self.mapView.userTrackingMode = MAUserTrackingModeFollow;
uid = [ZJUserInfoManager shared].uid;
}
[[TQNetworkTools shared] getWithAction:getLocationDataLast parameters:@{@"tid": uid} success:^(id _Nonnull response) {
......@@ -470,8 +716,8 @@
MAPointAnnotation *pointAnnotation = [[MAPointAnnotation alloc] init];
pointAnnotation.coordinate = CLLocationCoordinate2DMake(lat, lon);
pointAnnotation.title = @"latestLocation";
[_self.mapView addAnnotation:pointAnnotation];
[_self.mapView setCenterCoordinate:pointAnnotation.coordinate animated:false];
// [_self.mapView addAnnotation:pointAnnotation];
// [_self.mapView setCenterCoordinate:pointAnnotation.coordinate animated:false];
}else if ([[response objectForKey:@"status"] integerValue] == 105) {
[MBProgressHUD showError:[response objectForKey:@"msg"] toView:self.view];
......
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