×
Namespaces

Variants
Actions
Revision as of 05:10, 15 June 2012 by hamishwillee (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

计算坐标间的距离

From Nokia Developer Wiki
Jump to: navigation, search
Article Metadata

测试基于
设备:: Nokia 5800 XpressMusic

兼容于
平台: S60 3rd Edition, S60 5th Edition

平台安全性
需要的签名: Self-Signed
能力: Location

文章
关键词: TCoordinate
翻译:
hoolee
最后由 hamishwillee 在 15 Jun 2012 编辑
  • 详细描述

代码片段演示了如何在两个坐标间计算它们的距离。

注意:S60第三版FP2以及更新的平台上自签名程序需要定位能力

  • MMP文件

需要下列链接库

LIBRARY        lbs.lib


  • 头文件
#include <LbsPosition.h>
 
public:
TReal32 CalculateDistanceL(const TCoordinate& aFrom, const TCoordinate& aTo);


  • 源文件
TCoordinate you;
 
// Friend coordinates
TCoordinate friend;
 
// Calculate distance
TReal32 ret = CalculateDistanceL(you,friend);
 
// Distance in meters
TBuf<50> distance;
distance.Format(_L("%.1f"), ret);
distance.Append(_L(" m "));


  • 后记

你和你朋友之间的距离可以通过上述代码计算出来。

This page was last modified on 15 June 2012, at 05:10.
57 page views in the last 30 days.
×