15
我正在一个应用程序,它具有雷达的功能就像LOVOO应用程序。我没有CoreLocation和其他基于位置的框架的工作经验。雷达像滑块的LOVOO应用程序
如果你能告诉我应该如何实现这将是非常感谢。 我应该使用什么框架以及如何进行最初的操作。
虽然同样的问题已经存在于SO在这里我的问题是相同的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是否正确,如果它们是正确的,那我该如何更改滑块值的这些值。
我创建了一个类似的LOVOO,如带有滑块的iOS的雷达视图。它在github上可用。 https://github.com/abm-adnan/Radar – Adnan 2015-05-12 05:01:09
多数民众赞成在这真的很棒..我一定会看看你是如何做到这一点,但是我也创建了它,但没有公开,因为NDA与我的客户签署。谢谢 – pankaj 2015-05-12 10:39:13
如果您需要任何帮助,请告诉我如何提供帮助。谢谢 – Adnan 2015-05-12 10:59:39