Ios 雷达般的LOVOO应用程序,带滑块

Ios 雷达般的LOVOO应用程序,带滑块,ios,iphone,core-location,augmented-reality,Ios,Iphone,Core Location,Augmented Reality,我正在开发一款具有雷达功能的应用程序,就像LOVOO应用程序一样。我没有在CoreLocation和其他基于位置的框架上工作的经验 如果您能建议我如何实现这一目标,我将不胜感激。 我应该使用什么框架,以及如何开始 虽然同样的问题已经存在,所以在这里我的问题是一样的,但它对我没有用,这就是为什么我再次问它 到目前为止,我自己尝试过的是,我有要绘制的点的lat和long值,我计算了中心点(我的位置)和其他点之间的角度和距离 - (float)angletoCoordinate:(CLLocation

我正在开发一款具有雷达功能的应用程序,就像LOVOO应用程序一样。我没有在CoreLocation和其他基于位置的框架上工作的经验

如果您能建议我如何实现这一目标,我将不胜感激。 我应该使用什么框架,以及如何开始

虽然同样的问题已经存在,所以在这里我的问题是一样的,但它对我没有用,这就是为什么我再次问它

到目前为止,我自己尝试过的是,我有要绘制的点的lat和long值,我计算了中心点(我的位置)和其他点之间的角度和距离

- (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;
}

我不确定x和y是否正确,如果它们正确,那么如何通过滑块值的更改来更改这些值

我认为这里的关键词是地理围栏

地理围栏是当您的设备进入或离开某个区域时自动触发的动作。对于您的情况,您的操作是显示进入雷达区域的用户的配置文件

基本上,您需要计算圆形区域(给定半径)并显示区域内的所有其他点

我曾经发现这本教程可以教你如何自己做:


我希望有帮助

我已经用slider为iOS创建了一个类似LOVOO的雷达视图。它在github上提供。那真是太好了。。我肯定会看看你是如何做到这一点的,但是的,我也创造了它,但没有公开,由于保密协议签署了我的客户。谢谢如果你需要帮助,请告诉我我能帮什么忙。谢谢
    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++;
    }