Commit 9a7bf36e authored by lmj_521aiau@163.com's avatar lmj_521aiau@163.com

no message

parent 3a69aa84
...@@ -19,7 +19,7 @@ ...@@ -19,7 +19,7 @@
@property (nonatomic, strong) ZJFriendModel *selectFriendModel; @property (nonatomic, strong) ZJFriendModel *selectFriendModel;
@property (nonatomic, assign) ZJMapType mapType; @property (nonatomic, assign) ZJMapType mapType;
@property (nonatomic, assign) BOOL friendTrack;
/********************/ /********************/
@property (nonatomic, strong) MAMapView * GDMapView; @property (nonatomic, strong) MAMapView * GDMapView;
///全轨迹overlay ///全轨迹overlay
...@@ -45,7 +45,7 @@ ...@@ -45,7 +45,7 @@
self.friendDataSource = [NSMutableArray array]; self.friendDataSource = [NSMutableArray array];
[self setupUI]; [self setupUI];
[self getFriendList]; // [self getFriendList];
} }
- (void)viewDidAppear:(BOOL)animated { - (void)viewDidAppear:(BOOL)animated {
...@@ -62,6 +62,12 @@ ...@@ -62,6 +62,12 @@
} }
self.mapType = mapType; self.mapType = mapType;
if (!self.friendTrack){
CLLocationCoordinate2D coord = CLLocationCoordinate2DMake(location.coordinate.latitude, location.coordinate.longitude);
self.GGMapView.camera = [GMSCameraPosition cameraWithTarget:coord zoom:self.zoom];
[self setPoint:coord target:1];
}
}]; }];
} }
...@@ -71,7 +77,7 @@ ...@@ -71,7 +77,7 @@
} }
- (void)setMapType:(ZJMapType)mapType{ - (void)setMapType:(ZJMapType)mapType{
_mapType = ZJ_GMSMapType; _mapType = mapType;
if (_mapType == ZJ_GMSMapType) { if (_mapType == ZJ_GMSMapType) {
_GGMapView.hidden = NO; _GGMapView.hidden = NO;
_GDMapView.hidden = YES; _GDMapView.hidden = YES;
...@@ -104,8 +110,7 @@ ...@@ -104,8 +110,7 @@
[self setPoint:camera.target target:1]; [self setPoint:camera.target target:1];
// self.GDMapView = [[MAMapView alloc] initWithFrame:self.view.bounds];
self.GDMapView = [[MAMapView alloc] initWithFrame:self.view.bounds];
_GDMapView.delegate = self; _GDMapView.delegate = self;
_GDMapView.zoomLevel = 14; _GDMapView.zoomLevel = 14;
_GDMapView.showsScale = false; _GDMapView.showsScale = false;
...@@ -122,7 +127,7 @@ ...@@ -122,7 +127,7 @@
_GDMapView.mapLanguage = @1; _GDMapView.mapLanguage = @1;
[_GDMapView performSelector:NSSelectorFromString(@"setMapLanguage:") withObject:@(1)]; [_GDMapView performSelector:NSSelectorFromString(@"setMapLanguage:") withObject:@(1)];
} }
[self.view addSubview: _GDMapView]; // [self.view addSubview: _GDMapView];
_GDMapView.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight; _GDMapView.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;
_GDMapView.hidden = YES; _GDMapView.hidden = YES;
...@@ -233,7 +238,7 @@ ...@@ -233,7 +238,7 @@
if (self.mapType == ZJ_GMSMapType){ if (self.mapType == ZJ_GMSMapType){
CLLocationCoordinate2D coord = CLLocationCoordinate2DMake([[[self.data Read] objectForKey:@"latitude"] doubleValue], [[[self.data Read] objectForKey:@"longitude"] doubleValue]); CLLocationCoordinate2D coord = CLLocationCoordinate2DMake([[[self.data Read] objectForKey:@"latitude"] doubleValue], [[[self.data Read] objectForKey:@"longitude"] doubleValue]);
[self setPoint:coord target:2]; [self setPoint:coord target:1];
}else{ }else{
///如果您需要进入地图就显示定位小蓝点,则需要下面两行代码 ///如果您需要进入地图就显示定位小蓝点,则需要下面两行代码
self.GDMapView.showsUserLocation = YES; self.GDMapView.showsUserLocation = YES;
...@@ -262,6 +267,7 @@ ...@@ -262,6 +267,7 @@
#pragma mark 获取最后一次位置 #pragma mark 获取最后一次位置
- (void)getLastLocation:(ZJFriendModel *)model{ - (void)getLastLocation:(ZJFriendModel *)model{
self.friendTrack = NO;
if (![ZJUserInfoManager shared].isMember) { if (![ZJUserInfoManager shared].isMember) {
return; return;
} }
...@@ -284,10 +290,11 @@ ...@@ -284,10 +290,11 @@
double lat = [response[@"result"][@"data"][@"lat"] doubleValue]; double lat = [response[@"result"][@"data"][@"lat"] doubleValue];
double lon = [response[@"result"][@"data"][@"lon"] doubleValue]; double lon = [response[@"result"][@"data"][@"lon"] doubleValue];
self.friendTrack = YES;
if (self.mapType == ZJ_GMSMapType){ if (self.mapType == ZJ_GMSMapType){
CLLocationCoordinate2D coord = CLLocationCoordinate2DMake(lat, lon); CLLocationCoordinate2D coord = CLLocationCoordinate2DMake(lat, lon);
self.GGMapView.camera = [GMSCameraPosition cameraWithTarget:coord zoom:self.zoom]; self.GGMapView.camera = [GMSCameraPosition cameraWithTarget:coord zoom:self.zoom];
[self setPoint:coord target:1]; [self setPoint:coord target:2];
[_self.GGMapView animateToLocation:coord]; [_self.GGMapView animateToLocation:coord];
}else{ }else{
MAPointAnnotation *pointAnnotation = [[MAPointAnnotation alloc] init]; MAPointAnnotation *pointAnnotation = [[MAPointAnnotation alloc] init];
......
...@@ -31,7 +31,6 @@ ...@@ -31,7 +31,6 @@
@property (nonatomic, strong) ZJAlertView *alertView; @property (nonatomic, strong) ZJAlertView *alertView;
@property (nonatomic, assign) BOOL refershMyself;
@property (nonatomic, assign) ZJMapType mapType; @property (nonatomic, assign) ZJMapType mapType;
/********************/ /********************/
...@@ -97,7 +96,6 @@ ...@@ -97,7 +96,6 @@
- (void)viewDidAppear:(BOOL)animated { - (void)viewDidAppear:(BOOL)animated {
[super viewDidAppear:animated]; [super viewDidAppear:animated];
self.refershMyself = YES;
[[ZJLocationManager shared] initWithLocationUpdateInfo:^(ZJLocationModel * model, CLLocation * location, ZJMapType mapType) { [[ZJLocationManager shared] initWithLocationUpdateInfo:^(ZJLocationModel * model, CLLocation * location, ZJMapType mapType) {
if(!model){ if(!model){
...@@ -105,15 +103,12 @@ ...@@ -105,15 +103,12 @@
} }
self.mapType = mapType; self.mapType = mapType;
//
// CLLocationCoordinate2D coord = CLLocationCoordinate2DMake(model.latitude, model.longitude); if (self.isMyTrack){
// CLLocationCoordinate2D coord = CLLocationCoordinate2DMake(location.coordinate.latitude, location.coordinate.longitude);
// if (self.refershMyself) { self.GGMapView.camera = [GMSCameraPosition cameraWithTarget:coord zoom:self.zoom];
// self.GGMapView.camera = [GMSCameraPosition cameraWithTarget:coord zoom:self.zoom]; [self setPoint:coord target:1];
// self.refershMyself = NO; }
// }
//
// [self setPoint:coord target:1];
}]; }];
} }
...@@ -171,7 +166,7 @@ ...@@ -171,7 +166,7 @@
} }
- (void)setMapType:(ZJMapType)mapType{ - (void)setMapType:(ZJMapType)mapType{
_mapType = ZJ_GMSMapType; _mapType = mapType;
if (_mapType == ZJ_GMSMapType) { if (_mapType == ZJ_GMSMapType) {
_GGMapView.hidden = NO; _GGMapView.hidden = NO;
_GDMapView.hidden = YES; _GDMapView.hidden = YES;
...@@ -194,7 +189,7 @@ ...@@ -194,7 +189,7 @@
_GGMapView.hidden = YES; _GGMapView.hidden = YES;
self.GDMapView = [[MAMapView alloc] initWithFrame:self.view.bounds]; // self.GDMapView = [[MAMapView alloc] initWithFrame:self.view.bounds];
_GDMapView.delegate = self; _GDMapView.delegate = self;
_GDMapView.zoomLevel = 14; _GDMapView.zoomLevel = 14;
_GDMapView.showsScale = false; _GDMapView.showsScale = false;
...@@ -211,7 +206,7 @@ ...@@ -211,7 +206,7 @@
_GDMapView.mapLanguage = @1; _GDMapView.mapLanguage = @1;
[_GDMapView performSelector:NSSelectorFromString(@"setMapLanguage:") withObject:@(1)]; [_GDMapView performSelector:NSSelectorFromString(@"setMapLanguage:") withObject:@(1)];
} }
[self.view addSubview: _GDMapView]; // [self.view addSubview: _GDMapView];
_GDMapView.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight; _GDMapView.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;
_GDMapView.hidden = YES; _GDMapView.hidden = YES;
...@@ -402,10 +397,7 @@ ...@@ -402,10 +397,7 @@
if (self.mapType == ZJ_GMSMapType){ if (self.mapType == ZJ_GMSMapType){
CLLocationCoordinate2D coord = CLLocationCoordinate2DMake(lat, lon); CLLocationCoordinate2D coord = CLLocationCoordinate2DMake(lat, lon);
if (self.refershMyself) { self.GGMapView.camera = [GMSCameraPosition cameraWithTarget:coord zoom:self.zoom];
self.GGMapView.camera = [GMSCameraPosition cameraWithTarget:coord zoom:self.zoom];
self.refershMyself = NO;
}
[self setPoint:coord target:1]; [self setPoint:coord target:1];
}else{ }else{
MAPointAnnotation *pointAnnotation = [[MAPointAnnotation alloc] init]; MAPointAnnotation *pointAnnotation = [[MAPointAnnotation alloc] init];
......
...@@ -169,8 +169,8 @@ static ZJLocationManager * manager; ...@@ -169,8 +169,8 @@ static ZJLocationManager * manager;
BOOL isChina = NO; BOOL isChina = NO;
isChina = [placemark.ISOcountryCode isEqualToString:@"CN"]; isChina = [placemark.ISOcountryCode isEqualToString:@"CN"];
_mapType = isChina ? ZJ_MAMapType : ZJ_GMSMapType; // _mapType = isChina ? ZJ_MAMapType : ZJ_GMSMapType;
_mapType = ZJ_GMSMapType;
[self.data WirteDic:@(_mapType) Key:@"mapType"]; [self.data WirteDic:@(_mapType) Key:@"mapType"];
[self.data WirteDic:@(coord.latitude) Key:@"latitude"]; [self.data WirteDic:@(coord.latitude) Key:@"latitude"];
[self.data WirteDic:@(coord.longitude) Key:@"longitude"]; [self.data WirteDic:@(coord.longitude) Key:@"longitude"];
......
...@@ -100,7 +100,7 @@ static ZJUserInfoManager * manager; ...@@ -100,7 +100,7 @@ static ZJUserInfoManager * manager;
- (BOOL)isLogin{ - (BOOL)isLogin{
NSString * userInfoStr = [[self.data Read] objectForKey:@"userInfoDic"]; NSString * userInfoStr = [[self.data Read] objectForKey:@"userInfoDic"];
NSDictionary * userInfo = [self convertJsonStringToNSDictionary:userInfoStr]; NSDictionary * userInfo = [self convertJsonStringToNSDictionary:userInfoStr];
return userInfo?YES:NO; return userInfo ? YES : NO;
} }
- (BOOL)isTourist{ - (BOOL)isTourist{
......
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