JLChen
2021-11-16 b8d7b4fa382f7c779fb9e81a9f049d94a9083fa3
2021-11-16-01

添加地理围栏功能
1个文件已添加
14个文件已修改
510 ■■■■■ 已修改文件
HDL-ON_Android/Assets/Language.ini 7 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
HDL-ON_Android/Properties/AndroidManifest.xml 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
HDL-ON_iOS/AppDelegate.cs 3 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
HDL-ON_iOS/Resources/Language.ini 8 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
HDL_ON/Common/R.cs 12 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
HDL_ON/HDL_ON.projitems 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
HDL_ON/UI/MainPage.cs 4 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
HDL_ON/UI/UI2/3-Intelligence/Automation/AddInputType.cs 173 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
HDL_ON/UI/UI2/3-Intelligence/Automation/CalculatedDistance.cs 63 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
HDL_ON/UI/UI2/3-Intelligence/Automation/InpOrOutLogicMethod.cs 32 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
HDL_ON/UI/UI2/3-Intelligence/Automation/Logic.cs 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
HDL_ON/UI/UI2/3-Intelligence/Automation/LogicMethod.cs 172 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
HDL_ON/UI/UI2/3-Intelligence/Automation/MainView.cs 6 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
HDL_ON/UI/UI2/3-Intelligence/Automation/PublicInterface.cs 8 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
HDL_ON/UI/UI2/3-Intelligence/Automation/Send.cs 17 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
HDL-ON_Android/Assets/Language.ini
@@ -1009,6 +1009,9 @@
7149=Manually
7150=Smart
7151=Good
7152=Leave or arrive at a place
7153=Leave
7154=Arrive
@@ -2113,6 +2116,10 @@
7149=手动
7150=智能
7151=良好
7152=离开或到达某地
7153=离开
7154=到达
 
HDL-ON_Android/Properties/AndroidManifest.xml
@@ -176,5 +176,7 @@
        <meta-data android:name="OPPO_APPID" android:value="OP-30619979" />
        <meta-data android:name="OPPO_APPSECRET" android:value="OP-11d511c42f654cafac99588322681003" />
        <!-- 极光推送结束 -->
        <!-- 设置高德地图key -->
        <meta-data android:name="com.amap.api.v2.apikey" android:value="9901dd06e30b229efdd4c5bf5e076224" />
    </application>
</manifest>
HDL-ON_iOS/AppDelegate.cs
@@ -275,7 +275,8 @@
            //{
            //    //RemoteInfo.Current.ReadMsgList(true);
            //}
            //高德key
            GDMapKit.setGDApiKey("f0635ea15c5d579c6e93d9f07a06da69");
            Console.WriteLine("FinishedLaunching");
            return true;
        }
HDL-ON_iOS/Resources/Language.ini
@@ -1009,6 +1009,9 @@
7149=Manually
7150=Smart
7151=Good
7152=Leave or arrive at a place
7153=Leave
7154=Arrive
@@ -2113,6 +2116,11 @@
7149=手动
7150=智能
7151=良好
7152=离开或到达某地
7153=离开
7154=到达
 
HDL_ON/Common/R.cs
@@ -2620,6 +2620,18 @@
        /// 良好
        /// </summary>
        public const int lianghao = 7151;
        /// <summary>
        /// 离开或到达某地
        /// </summary>
        public const int likiadaoda = 7152;
        /// <summary>
        /// 离开
        /// </summary>
        public const int likai = 7153;
        /// <summary>
        /// 到达
        /// </summary>
        public const int daoda = 7154;
HDL_ON/HDL_ON.projitems
@@ -486,6 +486,7 @@
    <Compile Include="$(MSBuildThisFileDirectory)DAL\ThirdPartySdk\HDLLinphone.cs" />
    <Compile Include="$(MSBuildThisFileDirectory)UI\UI2\FuntionControlView\EnvironmentalScience\A_EnvironmentalDataCenter.cs" />
    <Compile Include="$(MSBuildThisFileDirectory)UI\UI2\2-Classification\SceneControlZone.cs" />
    <Compile Include="$(MSBuildThisFileDirectory)UI\UI2\3-Intelligence\Automation\CalculatedDistance.cs" />
  </ItemGroup>
  <ItemGroup>
    <Folder Include="$(MSBuildThisFileDirectory)Entity\Device\" />
HDL_ON/UI/MainPage.cs
@@ -10,6 +10,7 @@
{
    public static class MainPage
    {
        /// <summary>
        /// BaseView
        /// </summary>
@@ -144,7 +145,8 @@
                BaseView = Application.MainPage;
                Application.MainPage.BackgroundColor = CSS_Color.MainBackgroundColor;
                ///监听经纬度
                HDL_ON.UI.UI2.Intelligence.Automation.LogicMethod.CurrLogicMethod.AppLatAndLonEvent();
                //#region 测试
                //var ddd = new UI.test.TestDialog();
HDL_ON/UI/UI2/3-Intelligence/Automation/AddInputType.cs
@@ -67,11 +67,23 @@
                viewLayout.AddChidren(shiwaiView.FLayoutView());
            }
           
            //地理围栏
            LogicView.SelectTypeView likiadaodaView = new LogicView.SelectTypeView();
            likiadaodaView.frameLayout.Y = shiwaiView.frameLayout.Bottom;
            likiadaodaView.btnText.TextID = StringId.likiadaoda;
            likiadaodaView.btnIcon.UnSelectedImagePath = "LogicIcon/location.png";
            if (MainView.IsGatewayType)
            {
                viewLayout.AddChidren(likiadaodaView.FLayoutView());
            }
            #endregion
            #region  所有点击事件
            //时间
            timeView.btnClick.MouseUpEventHandler += (sen, e) => {
            timeView.btnClick.MouseUpEventHandler += (sen, e) =>
            {
                TimeTpye timeTpye = new TimeTpye();
                MainPage.BasePageView.AddChidren(timeTpye);
                timeTpye.Show();
@@ -79,7 +91,8 @@
            };
            //功能
            functionView.btnClick.MouseUpEventHandler += (sen, e) => {
            functionView.btnClick.MouseUpEventHandler += (sen, e) =>
            {
                FunTpye funTpye = new FunTpye();
                MainPage.BasePageView.AddChidren(funTpye);
                funTpye.Show(LogicMethod.condition_if);
@@ -91,7 +104,8 @@
                SceneMethod();
            };
            //室外变化
            shiwaiView.btnClick.MouseUpEventHandler += (sen, e) => {
            shiwaiView.btnClick.MouseUpEventHandler += (sen, e) =>
            {
                if (string.IsNullOrEmpty(Entity.DB_ResidenceData.Instance.CurrentRegion.homeAddress))//.longitude == 0 && Entity.DB_ResidenceData.Instance.CurrentRegion.latitude == 0)
                {
                    new PublicAssmebly().TipMsg(StringId.tip, StringId.GatewayLocationInformationIsNotConfigured);
@@ -101,6 +115,12 @@
                MainPage.BasePageView.AddChidren(weather);
                weather.Show();
                MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1;
            };
            //地理围栏
            likiadaodaView.btnClick.MouseUpEventHandler += (sen, e) =>
            {
                LocationView(this, false);
            };
            #endregion
@@ -141,6 +161,150 @@
        }
        /// <summary>
        /// 地理围栏View
        /// </summary>
        /// <param name="flMain">Fl main.</param>
        /// <param name="edit">If set to <c>true</c> edit.</param>
        public void LocationView(FrameLayout flMain, bool edit)
        {
            string strname = "";
            ///通过调试宝给的经纬度<标准GPS>
            double latitude = Entity.DB_ResidenceData.Instance.CurrentRegion.latitude;//纬度
            double longitude = Entity.DB_ResidenceData.Instance.CurrentRegion.longitude;//经度
            //WGS84坐标转高德坐标
            LogicMethod.CurrLogicMethod.WGS84_to_GCJ02(Entity.DB_ResidenceData.Instance.CurrentRegion.longitude, Entity.DB_ResidenceData.Instance.CurrentRegion.latitude, out longitude, out latitude);
            int r = 500;//半径
            if (edit)
            {
                for (var i = 0; i < Logic.currlogic.input.Count; i++)
                {
                    var input = Logic.currlogic.input[i];
                    if (input.condition_type != "8")
                    {
                        continue;
                    }
                    if (input.condition[0]["value"] == "arrive")
                    {
                        //到达某地
                        strname = Language.StringByID(StringId.daoda);
                    }
                    else
                    {
                        //离开地点
                        strname = Language.StringByID(StringId.likai);
                    }
                    //纬度
                    latitude = Convert.ToDouble(input.geo_fence.latitude);
                    //经度
                    longitude = Convert.ToDouble(input.geo_fence.longitude);
                    //半径
                    r = int.Parse(input.geo_fence.radius);
                }
            }
            PublicInterface publicInterface = new PublicInterface();
            var list = publicInterface.GetViewList("地理围栏");
            publicInterface.SingleSelectionShow(flMain, list, Language.StringByID(StringId.likiadaoda), strname, (str) =>
             {
                 string valueStr = "arrive";
                 if (str == Language.StringByID(StringId.daoda))
                 {
                     //到达某地
                     valueStr = "arrive";
                 }
                 else
                 {
                     //离开
                     valueStr = "leave";
                 }
#if __Android__
                 //申请定位权限
                 ((BaseActivity)Application.Activity).SetGPSLocationPermission((result1) =>
                  {
                      if (result1 == false) { return; }
                  //申请允许程序写入外部存储,如SD卡上写文件
                  ((BaseActivity)Application.Activity).SetPermission((result2) =>
                  {
                      if (result2 == false) { return; }
                       //读取电话状态权限
                       ((BaseActivity)Application.Activity).SetPermission((result3) =>
                       {
                           if (result3 == false) { return; }
                           //调用方法,跳转页面
                           GDMapKit.Show((mLatitude, mLongitude, mRadius, name) =>
                            {
                               //高德坐标转WGS84坐标(高德地图设置GPS)
                               double out_lng, out_lat;
                                LogicMethod.CurrLogicMethod.GCJ02_to_WGS84(mLongitude, mLatitude, out out_lng, out out_lat);
                                Input input = new Input();
                                input.sid = LogicMethod.CurrLogicMethod.NewSid();
                                input.condition_type = "8";
                                Dictionary<string, string> dic = new Dictionary<string, string>();
                                LogicMethod.CurrLogicMethod.dictionary(dic, "key", "direction");
                                LogicMethod.CurrLogicMethod.dictionary(dic, "comparator", "=");
                                LogicMethod.CurrLogicMethod.dictionary(dic, "data_type", "string");
                                LogicMethod.CurrLogicMethod.dictionary(dic, "value", valueStr);
                                input.condition.Add(dic);
                               //纬度
                               input.geo_fence.latitude = out_lat.ToString();
                               //经度
                               input.geo_fence.longitude = out_lng.ToString();
                               //半径<单位米>
                               input.geo_fence.radius = mRadius.ToString();
                                AddCondition(input);
                                LogicMethod.CurrLogicMethod.RemoveAllView();
                                AddLogic addLogic = new AddLogic();
                                MainPage.BasePageView.AddChidren(addLogic);
                                addLogic.Show();
                                MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1;
                            }, strname, Language.StringByID(StringId.save), true, latitude, longitude, r);
                       }, "android.permission.READ_PHONE_STATE");
                  }, "android.permission.WRITE_EXTERNAL_STORAGE");
                  });
#endif
#if __IOS__
                //调用方法,跳转页面
                GDMapKit.Show((mLatitude, mLongitude, mRadius, name) =>
                {
                   //高德坐标转WGS84坐标(高德地图设置GPS)
                             double out_lng, out_lat;
                             LogicMethod.CurrLogicMethod.GCJ02_to_WGS84(mLongitude, mLatitude, out out_lng, out out_lat);
                              Input input = new Input();
                              input.sid = LogicMethod.CurrLogicMethod.NewSid();
                              input.condition_type = "8";
                              Dictionary<string, string> dic = new Dictionary<string, string>();
                              LogicMethod.CurrLogicMethod.dictionary(dic, "key", "direction");
                              LogicMethod.CurrLogicMethod.dictionary(dic, "comparator", "=");
                              LogicMethod.CurrLogicMethod.dictionary(dic, "data_type", "string");
                              LogicMethod.CurrLogicMethod.dictionary(dic, "value", "arrive");
                              input.condition.Add(dic);
                              //纬度
                              input.geo_fence.latitude = out_lat.ToString();
                              //经度
                              input.geo_fence.longitude = out_lng.ToString();
                              //半径<单位米>
                              input.geo_fence.radius = mRadius.ToString();
                              AddCondition(input);
                              LogicMethod.CurrLogicMethod.RemoveAllView();
                              AddLogic addLogic = new AddLogic();
                              MainPage.BasePageView.AddChidren(addLogic);
                              addLogic.Show();
                              MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1;
                }, strname, Language.StringByID(R.MyInternationalizationString.uSave), true, latitude, longitude, r);
#endif
             });
        }
        /// <summary>
        /// 添加条件
        /// </summary>
        /// <param name="input"></param>
@@ -151,8 +315,9 @@
            for (var i = 0; i < Logic.currlogic.input.Count; i++)
            {
                var condition_type = Logic.currlogic.input[i].condition_type;
                if (condition_type == "10")
                if (condition_type == "10" || condition_type == "8")
                {
                    //支持场景=10,地理围栏=8
                    ///找到标记索引,退出循环体
                    index = i;
                    break;
HDL_ON/UI/UI2/3-Intelligence/Automation/CalculatedDistance.cs
New file
@@ -0,0 +1,63 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Infrastructure.Service.Helper
{
    public class CalculatedDistance
    {
        private static double HaverSin(double theta)
        {
            var v = Math.Sin(theta / 2);
            return v * v;
        }
        static double EARTH_RADIUS = 6371.0;//km 地球半径 平均值,千米
        /// <summary>
        /// 给定的经度1,纬度1;经度2,纬度2. 计算2个经纬度之间的距离。
        /// </summary>
        /// <param name="lat1">经度1</param>
        /// <param name="lon1">纬度1</param>
        /// <param name="lat2">经度2</param>
        /// <param name="lon2">纬度2</param>
        /// <returns>距离(公里、千米)</returns>
        public static int Distance(double lat1, double lon1, double lat2, double lon2)
        {
            //用haversine公式计算球面两点间的距离。
            //经纬度转换成弧度
            lat1 = ConvertDegreesToRadians(lat1);
            lon1 = ConvertDegreesToRadians(lon1);
            lat2 = ConvertDegreesToRadians(lat2);
            lon2 = ConvertDegreesToRadians(lon2);
            //差值
            var vLon = Math.Abs(lon1 - lon2);
            var vLat = Math.Abs(lat1 - lat2);
            //h is the great circle distance in radians, great circle就是一个球体上的切面,它的圆心即是球心的一个周长最大的圆。
            var h = HaverSin(vLat) + Math.Cos(lat1) * Math.Cos(lat2) * HaverSin(vLon);
            var distance = (int)((2 * EARTH_RADIUS * Math.Asin(Math.Sqrt(h))) * 1000);
            return distance;
        }
        /// <summary>
        /// 将角度换算为弧度。
        /// </summary>
        /// <param name="degrees">角度</param>
        /// <returns>弧度</returns>
        private static double ConvertDegreesToRadians(double degrees)
        {
            return degrees * Math.PI / 180;
        }
        private static double ConvertRadiansToDegrees(double radian)
        {
            return radian * 180.0 / Math.PI;
        }
    }
}
HDL_ON/UI/UI2/3-Intelligence/Automation/InpOrOutLogicMethod.cs
@@ -521,6 +521,31 @@
                            }
                        }
                        break;
                    case "8":
                        {
                            inputView.btnIcon.UnSelectedImagePath = "LogicIcon/location.png";
                            foreach (var dic in dicList)
                            {
                                string strtext = "";
                                string value = dic["value"];
                                switch (value)
                                {
                                    case "arrive":
                                        {
                                            strtext = Language.StringByID(StringId.daoda);
                                        }
                                        break;
                                    case "leave":
                                        {
                                            strtext = Language.StringByID(StringId.likai);
                                        }
                                        break;
                                }
                                inputView.btnText.TextID = StringId.likiadaoda;
                                inputView.btnState.Text = strtext;
                            }
                        }
                        break;
                    case "9":
                        {
                            inputView.btnIcon.UnSelectedImagePath = "LogicIcon/changesinoutdoor.png";
@@ -851,6 +876,13 @@
                                MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1;
                            }
                            break;
                        case "8":
                            {
                                AddInputType addInputType = new AddInputType();
                                addInputType.LocationView(thisView,true);
                            }
                            break;
                        case "9":
                            {
HDL_ON/UI/UI2/3-Intelligence/Automation/Logic.cs
@@ -142,7 +142,7 @@
        /// </summary>
        public string latitude = string.Empty;
        /// <summary>
        /// 单位米
        /// 半径<单位米>
        /// </summary>
        public string radius = string.Empty;
    }
HDL_ON/UI/UI2/3-Intelligence/Automation/LogicMethod.cs
@@ -709,6 +709,178 @@
            }
        }
        #region 高德坐标转WGS84坐标
        /// <summary>
        /// 高德坐标转WGS84坐标
        /// </summary>
        /// <param name="in_lng"></param>
        /// <param name="in_lat"></param>
        /// <param name="out_lng"></param>
        /// <param name="out_lat"></param>
        public void GCJ02_to_WGS84(double in_lng, double in_lat, out double out_lng, out double out_lat)
        {
            if (OutOfChina(in_lat, in_lng))
            {
                out_lng = in_lng;
                out_lat = in_lat;
                return;
            }
            CalculateDev(in_lng, in_lat, out out_lng, out out_lat);
            out_lng = in_lng - out_lng;
            out_lat = in_lat - out_lat;
        }
        #endregion
        #region WGS84坐标转高德坐标
        /// <summary>
        /// WGS84坐标转高德坐标
        /// </summary>
        /// <param name="in_lng">经度</param>
        /// <param name="in_lat">纬度</param>
        /// <param name="out_lng"></param>
        /// <param name="out_lat"></param>
        public void WGS84_to_GCJ02(double in_lng, double in_lat, out double out_lng, out double out_lat)
        {
            if (OutOfChina(in_lat, in_lng))
            {
                out_lng = in_lng;
                out_lat = in_lat;
                return;
            }
            CalculateDev(in_lng, in_lat, out out_lng, out out_lat);
            out_lng = in_lng + out_lng;
            out_lat = in_lat + out_lat;
        }
        #endregion
        /// <summary>
        /// 坐标是否在中国境内
        /// </summary>
        /// <param name="lat"></param>
        /// <param name="lng"></param>
        /// <returns></returns>
        public bool OutOfChina(double lat, double lng)
        {
            if (lng < 72.004 || lng > 137.8347)
                return true;
            if (lat < 0.8293 || lat > 55.8271)
                return true;
            return false;
        }
        /// <summary>
        /// 计算偏差
        /// </summary>
        /// <param name="in_lng"></param>
        /// <param name="in_lat"></param>
        /// <param name="dLng"></param>
        /// <param name="dLat"></param>
        private void CalculateDev(double in_lng, double in_lat, out double dLng, out double dLat)
        {
            dLat = TransformLat(in_lng - 105.0, in_lat - 35.0);
            dLng = TransformLng(in_lng - 105.0, in_lat - 35.0);
            double radLat = in_lat / 180.0 * pi;
            double magic = Math.Sin(radLat);
            magic = 1 - ee * magic * magic;
            double sqrtMagic = Math.Sqrt(magic);
            dLat = (dLat * 180.0) / ((a * (1 - ee)) / (magic * sqrtMagic) * pi);
            dLng = (dLng * 180.0) / (a / sqrtMagic * Math.Cos(radLat) * pi);
        }
        private double TransformLat(double x, double y)
        {
            double ret = -100.0 + 2.0 * x + 3.0 * y + 0.2 * y * y + 0.1 * x * y + 0.2 * Math.Sqrt(Math.Abs(x));
            ret += (20.0 * Math.Sin(6.0 * x * pi) + 20.0 * Math.Sin(2.0 * x * pi)) * 2.0 / 3.0;
            ret += (20.0 * Math.Sin(y * pi) + 40.0 * Math.Sin(y / 3.0 * pi)) * 2.0 / 3.0;
            ret += (160.0 * Math.Sin(y / 12.0 * pi) + 320 * Math.Sin(y * pi / 30.0)) * 2.0 / 3.0;
            return ret;
        }
        private double TransformLng(double x, double y)
        {
            double ret = 300.0 + x + 2.0 * y + 0.1 * x * x + 0.1 * x * y + 0.1 * Math.Sqrt(Math.Abs(x));
            ret += (20.0 * Math.Sin(6.0 * x * pi) + 20.0 * Math.Sin(2.0 * x * pi)) * 2.0 / 3.0;
            ret += (20.0 * Math.Sin(x * pi) + 40.0 * Math.Sin(x / 3.0 * pi)) * 2.0 / 3.0;
            ret += (150.0 * Math.Sin(x / 12.0 * pi) + 300.0 * Math.Sin(x / 30.0 * pi)) * 2.0 / 3.0;
            return ret;
        }
        // 椭球参数-圆周率
        private const double pi = 3.14159265358979324;
        // (北京54)椭球长半轴,卫星椭球坐标投影到平面地图坐标系的投影因子
        private const double a = 6378245.0;
        /*
            * Krasovsky 1940 (北京54)椭球长半轴第一偏心率平方
            * 计算方式:
            * 长半轴:
            * a = 6378245.0
            * 扁率:
            * 1/f = 298.3(变量相关计算为:(a-b)/a)
            * 短半轴:
            * b = 6356863.0188 (变量相关计算方法为:b = a * (1 - f))
            * 第一偏心率平方:
            * e2 = (a^2 - b^2) / a^2;
        */
        private const double ee = 0.00669342162296594323;
        /// <summary>
        /// APP上报GPS经纬度
        /// </summary>
        public void AppLatAndLonEvent()
        {
            Application.LocationAction += (lon, lat) =>
            {
                ////GPS坐标转成高德坐标
                //double out_lng, out_lat;
                //this.WGS84_to_GCJ02(lon, lat, out out_lng, out out_lat);
                //上报经纬度
                this.AutomatedGeofenceStatusReporting(lon, lat);
            };
        }
        /// <summary>
        /// 自动化地理围栏状态上报云端
        /// </summary>
        /// <param name="out_lng">APP经度</param>
        /// <param name="out_lat">APP纬度</param>
        private void AutomatedGeofenceStatusReporting(double out_lng, double out_lat)
        {
            List<LogicData> logicDataList = new List<LogicData>();
            //获取逻辑ID列表
            var idStr = Send.GetLogicIdList();
            if (idStr.Code == "0" && idStr.Data != null && idStr.Data.ToString() != "")
            {
                var date = Newtonsoft.Json.JsonConvert.SerializeObject(idStr.Data);
                logicDataList = Newtonsoft.Json.JsonConvert.DeserializeObject<List<LogicData>>(date);
            }
            ///有自动列表才处理
            if (logicDataList.Count>0) {
                ///遍历所有列表
                for (int i = 0; i < logicDataList.Count; i++)
                {
                    var logicDate = logicDataList[i];
                    ///自动化没有配置地理围栏不处理
                    if (string.IsNullOrEmpty(logicDate.geo_fence.latitude) || string.IsNullOrEmpty(logicDate.geo_fence.longitude))
                    {
                        //经纬度为空,不处理
                        continue;
                    }
                    //自动化纬度
                    double lat = Convert.ToDouble(logicDate.geo_fence.latitude);
                    //自动化经度
                    double lon = Convert.ToDouble(logicDate.geo_fence.longitude);
                    //自动化半径<单位米>
                    int radius = int.Parse(logicDate.geo_fence.radius);
                    //计算2个经纬度之间的距离
                    int r =Infrastructure.Service.Helper.CalculatedDistance.Distance(out_lat, out_lng, lat, lon);
                    //if () { }
                }
            }
        }
    }
}
HDL_ON/UI/UI2/3-Intelligence/Automation/MainView.cs
@@ -576,8 +576,10 @@
        /// 逻辑使能(开,关)
        /// </summary>
        public string enable = "";
        //public CycleA cycle;
        //public string modifyTime = "";
        /// <summary>
        /// 地理围栏配置
        /// </summary>
        public Fence geo_fence = new Fence();
    }
    class CycleA
HDL_ON/UI/UI2/3-Intelligence/Automation/PublicInterface.cs
@@ -736,6 +736,14 @@
                      };
                    }
                    break;
                case "地理围栏":
                    {
                        list = new List<string> {
             Language.StringByID(StringId.likai ),
             Language.StringByID(StringId.daoda),
                       };
                    }
                    break;
            }
            return list;
        }
HDL_ON/UI/UI2/3-Intelligence/Automation/Send.cs
@@ -106,6 +106,14 @@
                        conditionArray.Add(conditionJOb);
                    }
                    inputTypeJOb.Add("condition",conditionArray);
                    if (dictionary.condition_type=="8") {
                        ///地理围栏
                        var geo_fencejob = new JObject();
                        geo_fencejob.Add("longitude", dictionary.geo_fence.longitude);
                        geo_fencejob.Add("latitude", dictionary.geo_fence.latitude);
                        geo_fencejob.Add("radius", dictionary.geo_fence.radius);
                        inputTypeJOb.Add("geo_fence", geo_fencejob);
                    }
                    inputArray.Add(inputTypeJOb);
                }
@@ -217,6 +225,15 @@
                        conditionJOb.Add("data_type", dic["data_type"]);
                        conditionJOb.Add("value", dic["value"]);
                        conditionArray.Add(conditionJOb);
                        if (dictionary.condition_type == "8")
                        {
                            ///地理围栏
                            var geo_fencejob = new JObject();
                            geo_fencejob.Add("longitude", dictionary.geo_fence.longitude);
                            geo_fencejob.Add("latitude", dictionary.geo_fence.latitude);
                            geo_fencejob.Add("radius", dictionary.geo_fence.radius);
                            inputTypeJOb.Add("geo_fence", geo_fencejob);
                        }
                    }
                    inputTypeJOb.Add("condition", conditionArray);
                    inputArray.Add(inputTypeJOb);