我正在开发一种具有RADAR功能的应用程序,就像lovOO应用程序一样.我没有在CoreLocation和其他基于位置的框架上工作的经验.
如果你能建议我该如何实现,这将是非常感谢的.
我应该使用什么框架,以及如何最初进行.
虽然在这方面已经存在同样的问题,但我的问题与Radar View like LOVOO相同,但对我而言并不用,所以我再问一次.
到目前为止,我已经尝试了自己,我有积分和长的积分值,我计算了中心点(我的位置)和其他点之间的角度和距离
- (float)angletoCoordinate:(CLLocationCoordinate2D)second { //myCurrentLocation is origin //second is point float lat1 = degreesToradians(myCurrentLocation.coordinate.latitude); float lon1 = degreesToradians(myCurrentLocation.coordinate.longitude); float lat2 = degreesToradians(second.latitude); float lon2 = degreesToradians(second.longitude); float dLon = lon2 - lon1; float y = sin(dLon) * cos(lat2); float x = cos(lat1) * sin(lat2) - sin(lat1) * cos(lat2) * cos(dLon); float radiansbearing = atan2(y,x); if(radiansbearing < 0.0) { radiansbearing += 2*M_PI; } return radiansbearing; } -(float)calculateXPointWithLoc:(ARGeoLocation *)loc andDelta:(float)delta{ float angle = radiansTodegrees(delta); float dpx = (([myCurrentLocation distanceFromLocation:loc.geoLocation])/1000); if(0<=angle<=90) return viewRadar.center.x + sin(angle)*dpx ; else if(90<angle<=180) return viewRadar.center.x + cos(angle-90)*dpx ; else if(180<angle<=270) return viewRadar.center.x - cos(270-angle)*dpx ; else if(270<angle<360) return viewRadar.center.x - sin(360-angle)*dpx ; return 0; } -(float)calculateYPointWithLoc:(ARGeoLocation *)loc andDelta:(float)delta{ float angle = radiansTodegrees(delta); float dpx = (([myCurrentLocation distanceFromLocation:loc.geoLocation])/1000); if(0<=angle<=90) return viewRadar.center.y - cos(angle)*dpx ; else if(90<angle<=180) return viewRadar.center.y + sin(angle-90)*dpx ; else if(180<angle<=270) return viewRadar.center.y + sin(270-angle)*dpx ; else if(270<angle<360) return viewRadar.center.y - cos(360-angle)*dpx ; return 0; }
接着
int i = 0; for(ARGeoLocation *loc in coordinates){ deltaAz = [self angletoCoordinate:loc.geoLocation.coordinate]; x = [self calculateXPointWithLoc:loc andDelta:deltaAz]; y = [self calculateYPointWithLoc:loc andDelta:deltaAz]; [[plots objectAtIndex:i] setFrame:CGRectMake(x,y,DIAMETER_PLOT,DIAMETER_PLOT)]; i++; }
我不确定x和y是否正确,如果它们是正确的,那么如何更改这些值与滑块值的更改.