小编rkh*_*rkh的帖子

相机覆盖层随轴承和高程变化

伙计们,

我正在尝试获得如下图所示的实用程序.基本上,相机显示窗口覆盖设备屏幕的一部分,并且通过曲线或直线连接的点列表在相机视图上呈现为叠加.我知道这可以用石英绘制,但这不到我问题的一半.

真正的问题是,当轴承和高度发生变化时,叠加应该呈现不同的点.

例如:

  • 如果轴承必须改变+5度和高度+2度,则PT1将位于摄像机视图的右边缘旁边,PT2也将向右移动,PT3将可见.
  • 另一个改变轴承+10度的运动将使PT1不可见,PT2在右侧,PT3中间和PT4在摄像机视图的左边缘.

我的问题在图片后面:

图片描述了我想要完成的事情

  1. 是否有可能有一个远大于摄像机视图大小的视图(如下所示)并使用一些方法(我需要研究这些)来在轴承/高程变化时移动视图?是否建议表现明智?
  2. 石英是去这里的方式吗?我还需要什么(其他当然AVFoundation用于相机和相位/动作)?由于我的应用程序只是iOS 7,我可以使用iOS 7独有的任何新方法/ API.
  3. 除了raywendelrich关于增强现实游戏的教程之外,你知道的任何教程是否可以帮助我完成这项工作?

camera overlay augmented-reality ios

8
推荐指数
1
解决办法
1054
查看次数

在mongodb中对分组查询的结果进行分组

我有以下示例数据:

{
    "name": "Bob",
    "mi": "K",
    "martialStatus": "M",
    "age": 30,
    "city": "Paris",
    "job": "Engineer"
}
{
    "name": "Chad",
    "mi": "M",
    "martialStatus": "W",
    "age": 31,
    "city": "Paris",
    "job": "Doctor"
}
{
    "name": "Mel",
    "mi": "A",
    "martialStatus": "D",
    "age": 31,
    "city": "London",
    "job": "Doctor"
}
{
    "name": "Frank",
    "mi": "F",
    "martialStatus": "S",
    "age": 30,
    "city": "London",
    "job": "Engineer"
}
Run Code Online (Sandbox Code Playgroud)

我正在尝试编写一个 mongo 查询,该查询将以以下格式返回结果: "peopleCount": 4, "jobsList": { "job": "Doctor", "ageList": [ { "age": 31, "cityList ": [ { "city": "London", "people": [ { …

mongodb mongodb-query aggregation-framework

5
推荐指数
1
解决办法
1906
查看次数

故事板中UITextView的本地化

所以我在故事板中有一个带有不同按钮,标签和一些文本视图的应用程序,我直接在故事板中输入文本.我启用了基本本地化并添加了几种语言.

这为Base(英语)和其他语言生成了故事板,其中包含项目对象ID列表.我翻译了所有内容,标签和按钮(ALL OF THEM)工作并以我设置的语言显示.

然而,无论我设置哪种语言,文本字段都会显示初始英文文本...文本视图是否还有其他步骤?

localization interface-builder uitextview ios

3
推荐指数
1
解决办法
3007
查看次数

在groovy中按项目值对json字符串进行排序

我有以下代码块:

def response =  '[{"id": "121","startTime": "2013-11-10T20:48:54Z", "reqId": 123456, "endTime": null, "numFiles"     :null}, 
{"id": "123","startTime": "2013-11-29T21:45:00Z","reqId": 123458,"endTime": "2013-11-30T21:45:00Z", "numFiles"     :null }, 
{"id": "121","startTime": "2013-11-8T20:48:54Z", "reqId": 123111, "endTime": null, "numFiles" :null}]'

 def sortedResponse = response.sort { a,b -> b.reqId <=> a.reqId}

def reqRespAPI = new JsonSlurper().parseText(sortedResponse )

def id = reqRespAPI.id
def stTime = reqRespAPI.startTime
def eTime = reqRespAPI.endTime
def rqId = reqRespAPI.reqId
def numRec = reqRespAPI.numFiles

...some other stuff here....
Run Code Online (Sandbox Code Playgroud)

我正在尝试按 reqId (rqId) 降序排序。我必须使用 for 循环吗?当前 sortedResponse 抛出异常:

groovy.lang.MissingMethodException: No …

sorting groovy json

2
推荐指数
1
解决办法
5495
查看次数

didUpdateHeading 未在 swift 中调用

我正在尝试获取设备的航向信息,以便利用磁航向和真实航向之间的差异来确定用户位置的磁偏角。为此,我有一个 Helper 类和我的 MainVc (mvc)。在我的辅助类 init 方法中,我执行以下操作:

...
...
locationManager = CLLocationManager()
switch CLLocationManager.authorizationStatus() {
  case .AuthorizedAlways:
    locationManager.delegate = self
    locationManager.desiredAccuracy = kCLLocationAccuracyNearestTenMeters
    locationManager.startUpdatingLocation()
  case .NotDetermined:
    locationManager.requestAlwaysAuthorization()
  case .AuthorizedWhenInUse, .Restricted, .Denied:
    mvc.alertDenied();
}

if (!initialized)
{
  initialized = true;
  self.performSelector("finishUpdatingLocation", withObject: nil, afterDelay: 2.0);
}

}

func locationManager(manager: CLLocationManager, didUpdateLocations locations: [CLLocation]) {
    print ("didUpdateLocations")
    var userLocation:CLLocation = locations[0] as! CLLocation
    longitude = Float(userLocation.coordinate.longitude);
    latitude = Float(userLocation.coordinate.latitude);
  }


 func finishUpdatingLocation () {
    locationManager.stopUpdatingLocation();
    NSObject.cancelPreviousPerformRequestsWithTarget(self, selector: "finishUpdatingLocation", object: nil);
    mvc.goingToUpdateHeading();
    locationManager.startUpdatingHeading(); …
Run Code Online (Sandbox Code Playgroud)

cllocationmanager swift ios9

2
推荐指数
1
解决办法
3713
查看次数

MKMapPoint 与来自 MKMapRect 的 MKMapPointMake

我有以下代码:

 MKMapRect mRect = self.mapView.visibleMapRect;
 MKMapPoint eastMapPoint = MKMapPointMake(MKMapRectGetMaxX(mRect), MKMapRectGetMaxY(mRect)/2);
 MKMapPoint northMapPoint = MKMapPointMake(MKMapRectGetMaxX(mRect)/2, 0);
 MKMapPoint southMapPoint = MKMapPointMake(MKMapRectGetMaxX(mRect)/2, MKMapRectGetMaxY(mRect));
 MKMapPoint westMapPoint = MKMapPointMake(0, MKMapRectGetMaxY(mRect)/2);
Run Code Online (Sandbox Code Playgroud)

我正在将这些转换为CLLocationCoordinate2Dwith MKCoordinateForMapPoint。例如:

    CLLocationCoordinate2D northCoords = MKCoordinateForMapPoint(northMapPoint);
Run Code Online (Sandbox Code Playgroud)

与 一起northCoords,我有centerCoordswhich 是地图中心点的坐标。使用这两组坐标,我创建了一个数组,将这两组坐标CLLocationCoordinate2D coordinates[2]添加到其中...

下面,我用下面的代码在两个坐标之间画一条线:

    MKPolyline *polyLine = [MKPolyline polylineWithCoordinates:coordinates count:2];
    [_mapView addOverlay:polyLine];


- (MKOverlayView *)mapView:(MKMapView *)mapView viewForOverlay:(id <MKOverlay>)overlay 
{
    MKPolylineView *polylineView = [[MKPolylineView alloc] initWithPolyline:overlay];
    polylineView.strokeColor = [UIColor redColor];
    polylineView.lineWidth = 5.0;
    return polylineView;
}
Run Code Online (Sandbox Code Playgroud)

问题:

折线叠加起点(地图中心)始终从中心开始是正确的。然而,线路的另一端(北/南/东/西)没有正确指向它应该在的位置。在下图中,我正在绘制与上面的 4 MKMapPoint …

mapkit ios

1
推荐指数
1
解决办法
3756
查看次数