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

no message

parent ab66a73f
...@@ -39,7 +39,7 @@ ...@@ -39,7 +39,7 @@
ignoresPersistentStateOnLaunch = "NO" ignoresPersistentStateOnLaunch = "NO"
debugDocumentVersioning = "YES" debugDocumentVersioning = "YES"
debugServiceExtension = "internal" debugServiceExtension = "internal"
allowLocationSimulation = "YES"> allowLocationSimulation = "NO">
<BuildableProductRunnable <BuildableProductRunnable
runnableDebuggingMode = "0"> runnableDebuggingMode = "0">
<BuildableReference <BuildableReference
......
...@@ -33,19 +33,7 @@ ...@@ -33,19 +33,7 @@
@property (nonatomic, strong) GMSCircle * selfCircle; @property (nonatomic, strong) GMSCircle * selfCircle;
@property (nonatomic, strong) GMSMarker * selfMarker; @property (nonatomic, strong) GMSMarker * selfMarker;
@property (nonatomic, assign) float __block zoom; @property (nonatomic, assign) float __block zoom;
@property (nonatomic, assign) float __block animationZoom; @property (nonatomic, assign) BOOL referCamera;
@property (nonatomic, assign) NSTimer * ttt;
@property (nonatomic, assign) NSInteger tttCount;
@property (nonatomic, strong) GMSPolyline * initialPolyline;
@property (nonatomic, strong) GMSPolyline * actionPolyline;
@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;
@end @end
...@@ -66,6 +54,15 @@ ...@@ -66,6 +54,15 @@
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(2 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{ dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(2 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
[self getFriendList]; [self getFriendList];
}); });
[[ZJLocationManager shared] initWithLocationUpdateInfo:^(ZJLocationModel * model, CLLocation * location, ZJMapType mapType) {
if(!model){
return;
}
self.mapType = mapType;
}];
} }
- (void)viewWillAppear:(BOOL)animated{ - (void)viewWillAppear:(BOOL)animated{
...@@ -78,6 +75,13 @@ ...@@ -78,6 +75,13 @@
if (_mapType == ZJ_GMSMapType) { if (_mapType == ZJ_GMSMapType) {
_GGMapView.hidden = NO; _GGMapView.hidden = NO;
_GDMapView.hidden = YES; _GDMapView.hidden = YES;
if (_referCamera) {
GMSCameraPosition *camera = [GMSCameraPosition cameraWithLatitude:[[[self.data Read] objectForKey:@"latitude"] doubleValue] longitude:[[[self.data Read] objectForKey:@"longitude"] doubleValue] zoom:_zoom];
self.GGMapView.camera = camera;
_referCamera = NO;
}
}else{ }else{
_GGMapView.hidden = YES; _GGMapView.hidden = YES;
_GDMapView.hidden = NO; _GDMapView.hidden = NO;
...@@ -87,6 +91,9 @@ ...@@ -87,6 +91,9 @@
- (void)setupUI{ - (void)setupUI{
_zoom = 18; _zoom = 18;
GMSCameraPosition *camera = [GMSCameraPosition cameraWithLatitude:[[[self.data Read] objectForKey:@"latitude"] doubleValue] longitude:[[[self.data Read] objectForKey:@"longitude"] doubleValue] zoom:_zoom]; GMSCameraPosition *camera = [GMSCameraPosition cameraWithLatitude:[[[self.data Read] objectForKey:@"latitude"] doubleValue] longitude:[[[self.data Read] objectForKey:@"longitude"] doubleValue] zoom:_zoom];
if (![[self.data Read] objectForKey:@"latitude"]) {
_referCamera = YES;
}
///初始化地图 ///初始化地图
self.GGMapView = [GMSMapView mapWithFrame:self.view.bounds camera:camera]; self.GGMapView = [GMSMapView mapWithFrame:self.view.bounds camera:camera];
_GGMapView.delegate = self; _GGMapView.delegate = self;
...@@ -95,6 +102,8 @@ ...@@ -95,6 +102,8 @@
_GGMapView.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight; _GGMapView.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;
_GGMapView.hidden = YES; _GGMapView.hidden = YES;
[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;
...@@ -224,7 +233,7 @@ ...@@ -224,7 +233,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:1]; [self setPoint:coord target:2];
}else{ }else{
///如果您需要进入地图就显示定位小蓝点,则需要下面两行代码 ///如果您需要进入地图就显示定位小蓝点,则需要下面两行代码
self.GDMapView.showsUserLocation = YES; self.GDMapView.showsUserLocation = YES;
...@@ -274,11 +283,19 @@ ...@@ -274,11 +283,19 @@
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];
if (self.mapType == ZJ_GMSMapType){
CLLocationCoordinate2D coord = CLLocationCoordinate2DMake(lat, lon);
self.GGMapView.camera = [GMSCameraPosition cameraWithTarget:coord zoom:self.zoom];
[self setPoint:coord target:1];
[_self.GGMapView animateToLocation:coord];
}else{
MAPointAnnotation *pointAnnotation = [[MAPointAnnotation alloc] init]; MAPointAnnotation *pointAnnotation = [[MAPointAnnotation alloc] init];
pointAnnotation.coordinate = CLLocationCoordinate2DMake(lat, lon); pointAnnotation.coordinate = CLLocationCoordinate2DMake(lat, lon);
pointAnnotation.title = @"latestLocation"; pointAnnotation.title = @"latestLocation";
[self.GDMapView addAnnotation:pointAnnotation]; [_self.GDMapView addAnnotation:pointAnnotation];
[self.GDMapView setCenterCoordinate:pointAnnotation.coordinate animated:false]; [_self.GDMapView setCenterCoordinate:pointAnnotation.coordinate animated:false];
}
}else if ([[response objectForKey:@"status"] integerValue] == 105) { }else if ([[response objectForKey:@"status"] integerValue] == 105) {
[MBProgressHUD showError:[response objectForKey:@"msg"] toView:self.view]; [MBProgressHUD showError:[response objectForKey:@"msg"] toView:self.view];
...@@ -309,7 +326,7 @@ ...@@ -309,7 +326,7 @@
#pragma mark - GMSMap Function google #pragma mark - GMSMap Function google
- (void)setPoint:(CLLocationCoordinate2D)point target:(NSInteger)target{ - (void)setPoint:(CLLocationCoordinate2D)point target:(NSInteger)target{
if (target == 1) {
CLLocationCoordinate2D position = point; CLLocationCoordinate2D position = point;
_selfMarker.map = nil; _selfMarker.map = nil;
_selfMarker = [GMSMarker markerWithPosition:position]; _selfMarker = [GMSMarker markerWithPosition:position];
...@@ -317,11 +334,14 @@ ...@@ -317,11 +334,14 @@
// _selfMarker.icon = [GMSMarker markerImageWithColor:[UIColor blackColor]]; // _selfMarker.icon = [GMSMarker markerImageWithColor:[UIColor blackColor]];
_selfMarker.icon = [UIImage imageNamed:@"userPosition"]; _selfMarker.icon = [UIImage imageNamed:@"userPosition"];
_selfMarker.tracksInfoWindowChanges = YES; _selfMarker.tracksInfoWindowChanges = YES;
_selfMarker.title = @"Me";
_selfMarker.snippet = @"WTF";
_selfMarker.infoWindowAnchor = CGPointMake(0.5, 0.25); _selfMarker.infoWindowAnchor = CGPointMake(0.5, 0.25);
_selfMarker.map = _GGMapView; _selfMarker.map = _GGMapView;
if (target == 1) {
_selfMarker.title = @"Me";
_selfMarker.snippet = @"WTF";
CLLocationDistance distance = 50; CLLocationDistance distance = 50;
_selfCircle.map = nil; _selfCircle.map = nil;
_selfCircle = [GMSCircle circleWithPosition:position radius:distance]; _selfCircle = [GMSCircle circleWithPosition:position radius:distance];
...@@ -331,12 +351,14 @@ ...@@ -331,12 +351,14 @@
_selfCircle.map = _GGMapView; _selfCircle.map = _GGMapView;
}else{ }else{
CLLocationCoordinate2D position = point; _selfMarker.title = @"Friend";
GMSMarker *marker = [GMSMarker markerWithPosition:position]; _selfMarker.snippet = @"WTF";
marker.title = @"Hello World";
marker.map = _GGMapView;
} }
} }
#pragma mark - GMSMap Delegate google
-(void)mapView:(GMSMapView*)mapView idleAtCameraPosition:(GMSCameraPosition*)position{
_zoom = position.zoom;
}
@end @end
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