0

画面上の場所を示すアプリを作りたいと思います。iOS向けのAR:画面上での位置情報(緯度、経度)を表示します。

カメラの画像に、ユーザーが探しているかどうかを示すテキストを表示します。たとえば、ユーザーが自分の場所の北にある町を探している場合は、北に目を向けるとそれを示すテキストが表示されます。

また、ユーザーと場所の距離を表示する必要があります。

ユーザーの場所を知っているので、ユーザーが別の場所を探していることを示す必要があります。たとえば、私はニューヨークにいて、自由の女神像がどこにあるのか知りたいと思っています。私はその緯度と経度を知っていなければなりません。

これを行うSDKはありますか?

詳細が必要ですか?申し訳ありませんが、私は英語をうまく話せません。

答えて

3

手順は次のようになります。

  1. は、緯度と長い取得し、2つのラベル、self.label1とself.label2

  2. transparentColorの背景と空のビューを作成するには、それらを設定します。

  3. はaddSubviewを使用してラベルを追加しますステップ2.

  4. で作成したビューにステップ2.

  5. セットcameraOverlayViewのビューにごピッカーを提示します。

    コードで

はあなたの.hに定義します。CLLocationManager *locationManagerと実装デリゲート:<CLLocationManagerDelegate>

- (void)viewDidLoad { 
[super viewDidLoad]; 
locationManager = [[CLLocationManager alloc] init]; 
locationManager.delegate = self; 
locationManager.distanceFilter = kCLDistanceFilterNone; //How often do you want to update your location, this sets every small change should fire an update. 
locationManager.desiredAccuracy = kCLLocationAccuracyBest; 
[locationManager startUpdatingLocation]; 
} 

を次に実装します。

- (void)locationManager:(CLLocationManager *)manager didUpdateToLocation:(CLLocation *)newLocation fromLocation:(CLLocation *)oldLocation { 

    NSString *lat = [NSString stringWithFormat:@"%d", newLocation.coordinate.latitude]; 
    self.label1.text = lat; 

    NSString *long = [NSString stringWithFormat:@"%d", newLocation.coordinate.longitude]; 
    self.label2.text = long; 
} 

を次に、あなたを提示したい場所コード付きカメラ:

UIImagePickerController *picker = [[UIImagePickerController alloc] init]; 

picker.delegate = self; 

picker.sourceType = UIImagePickerControllerSourceTypeCamera; 

emptyView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 320, 480)]; //This frame will make it fullscreen... 

emptyView.backgroundColor = [UIColor transparentColor]; 
[emptyView setAlpha:1.0]; //I think it is not necessary, but it wont hurt to add this line. 

self.label1.frame = CGRectMake(100, 100, self.label1.frame.size.width, self.label1.frame.size.height); //Here you can specify the position in this case 100x 100y of your label1 preserving the width and height. 
[emptyView addSubview:self.label1]; 
//Repeat for self.label2 

    self.picker.cameraOverlayView = emptyView; //Which by the way is not empty any more.. 
    [emptyView release]; 
    [self presentModalViewController:self.picker animated:YES]; 
    [self.picker release]; 

私はこれをテストしていないので、十分に明確で、欠けているものはないと願っています。

+0

私はあなたの答えを理解しているか分かりません。ユーザーの場所を知っているので、ユーザーが別の場所を探していることを示す必要があります。たとえば、私はニューヨークにいて、自由の女神像がどこにあるのか知りたいと思っています。私はその緯度と経度を知っていなければなりません。 – VansFannel

+0

ああ、私はあなたの現在の位置をオーバーレイしたいと思った..あなたが求めるものは、画像認識ソフトウェアの多くです。 –

0
  1. ニコラスのようにあなたのポジションをお勧めします。
  2. 計算興味
  3. のあなたのポイントの位置を取得し、ユーザはコンパス
  4. から見ている方向を取得し、相対あなたに基づいて、ポイント・オブ・interesの「見出し」とポイントの-interests座標。
  5. ユーザーの見出しの周りにある場合は、情報と一緒に画面にlableを表示します。

他のソリューションは、opnenglで世界を構築し、あなたのOpenGLの座標に自分の緯度/経度の値を変換し、あなたのOpenGLの世界にあなたの関心点を置くことであろう。

最初の方がはるかに簡単ですが、私は第2の選択肢がより柔軟であると思います。

+2

0. Appleからparkサンプルコードをチェックアウトします。それはあなたがしたいことを正確にやっている – Craig

+0

素晴らしい1つ - 特に新しいコアモーションAPIの使用 – HeikoG

関連する問題