Пример #1
0
        /// <summary>
        /// 位置计算
        /// </summary>
        /// <param name="mode"></param>
        /// <param name="fromPoint"></param>
        /// <param name="toPoint"></param>
        /// <returns></returns>
        public string Distance(
            LazyTripMode mode,
            LazyLBSPoint fromPoint,
            LazyLBSPoint toPoint)
        {
            string result = string.Empty;

            if (string.IsNullOrEmpty(this.SecertKey))
            {
                result = LazyTencentLBSInterface.Distance(mode, new List <LazyLBSPoint>()
                {
                    fromPoint
                }, new List <LazyLBSPoint>()
                {
                    toPoint
                }, this.Key, this.SecertKey, null);
            }
            else
            {
                result = LazyTencentLBSInterface.Distance(mode, new List <LazyLBSPoint>()
                {
                    fromPoint
                }, new List <LazyLBSPoint>()
                {
                    toPoint
                }, this.Key, this.SecertKey, LazyTencentLBSInterface.GetMethodCountersign);
            }
            return(result);
        }
Пример #2
0
        /// <summary>
        /// 本接口提供由坐标到坐标所在位置的文字描述的转换。输入坐标返回地理位置信息和附近poi列表
        /// </summary>
        /// <param name="location"></param>
        /// <returns></returns>
        public string Geocoder(LazyLBSPoint location)
        {
            string result = string.Empty;

            if (string.IsNullOrEmpty(this.SecertKey))
            {
                result = LazyTencentLBSInterface.Geocoder(location, this.Key, this.SecertKey, null);
            }
            else
            {
                result = LazyTencentLBSInterface.Geocoder(location, this.Key, this.SecertKey, LazyTencentLBSInterface.GetMethodCountersign);
            }
            return(result);
        }
Пример #3
0
        /// <summary>
        /// 在地图中显示路线需要结合地图API或SDK实现相应功能
        /// </summary>
        /// <param name="mode">方式</param>
        /// <param name="fromPoint">来自点</param>
        /// <param name="toPoint"></param>
        /// <returns></returns>
        public string Direction(
            LazyTripMode2 mode,
            LazyLBSPoint fromPoint,
            LazyLBSPoint toPoint)
        {
            SortedDictionary <string, string> sortedDict = new SortedDictionary <string, string>();

            sortedDict.Add("from", fromPoint.ToString());
            sortedDict.Add("to", toPoint.ToString());
            sortedDict.Add("key", this.Key);
            Func <string, string, SortedDictionary <string, string>, string> countersign = null;

            if (!string.IsNullOrEmpty(this.SecertKey))
            {
                countersign = LazyTencentLBSInterface.GetMethodCountersign;
            }
            string result = string.Empty;

            switch (mode)
            {
            case LazyTripMode2.Driving:
                result = LazyTencentLBSInterface.Driving(this.SecertKey, sortedDict, countersign);
                break;

            case LazyTripMode2.Bicycling:
                result = LazyTencentLBSInterface.Bicycling(this.SecertKey, sortedDict, countersign);
                break;

            case LazyTripMode2.Transit:
                result = LazyTencentLBSInterface.Transit(this.SecertKey, sortedDict, countersign);
                break;

            case LazyTripMode2.Walking:
                result = LazyTencentLBSInterface.Walking(this.SecertKey, sortedDict, countersign);
                break;
            }
            return(result);
        }