示例#1
0
        private RadarRegion[] readLocalRegions()
        {
            List <RadarRegion> regions = new List <RadarRegion>();

            try
            {
                if (System.IO.File.Exists(_configPath))
                {
                    System.IO.StreamReader objReader = new System.IO.StreamReader(_configPath);
                    string sLine = "";
                    while (sLine != null)
                    {
                        sLine = objReader.ReadLine();
                        if (!string.IsNullOrWhiteSpace(sLine))
                        {
                            RadarRegion region = RadarRegionFromString.GetRegion(sLine);
                            regions.Add(region);
                        }
                    }
                    objReader.Close();
                }
            }
            catch (Exception ex)
            {
                LogService.WarnFormat(ex.ToString());
            }
            return(regions.ToArray());
        }
示例#2
0
 private void addNewRadarArea(string nameDefault = "")
 {
     try
     {
         var winAdd = new VTSCore.Layers.Base.ModifyValueClient("新增雷达区域名称设置", nameDefault);
         if (winAdd.ShowDialog().Value)
         {
             if (_radarAreas.IsEffectiveName(winAdd.Heading))
             {
                 RadarRegion region = new RadarRegion()
                 {
                     Name = winAdd.Heading, IsMask = true
                 };
                 importNewRadarArea(region);
                 initListView();
                 SelectedIndex(radarAreasListView.Items.Count - 1);
             }
             else
             {
                 addNewRadarArea(winAdd.Heading);
             }
         }
     }
     catch (Exception ex)
     {
         LogService.Error("导入区域错误!" + Environment.NewLine + ex.ToString());
         MessageBox.Show("导入区域错误!" + Environment.NewLine + ex.Message);
     }
 }
示例#3
0
 public static bool AreEqual(RadarRegion region1, RadarRegion region2)
 {
     if (region1 == null || region2 == null)
     {
         return(region1 == null && region2 == null);
     }
     if (region1.Name != region2.Name || region1.IsMask != region2.IsMask || region1.ManualIdenfity != region2.ManualIdenfity || region1.PassThrough != region2.PassThrough)
     {
         return(false);
     }
     if (region1.Polygon == null || region2.Polygon == null)
     {
         return(region1.Polygon == null && region2.Polygon == null);
     }
     if (region1.Polygon.Length != region2.Polygon.Length)
     {
         return(false);
     }
     for (int i = 0; i < region1.Polygon.Length; i++)
     {
         if (region1.Polygon[i] != region2.Polygon[i])
         {
             return(false);
         }
     }
     return(true);
 }
示例#4
0
 public RegionAndRadars(RadarRegion region, string[] radarNames)
 {
     Name           = region.Name;
     IsMask         = region.IsMask;
     ManualIdenfity = region.ManualIdenfity;
     PassThrough    = region.PassThrough;
     Polygon        = region.Polygon;
     RadarNames     = radarNames;
 }
示例#5
0
 public PlottingArea(ILocator locator, RadarRegion region)
 {
     _locator        = locator;
     _plottingStatus = PlottingStatus.新建模式;
     _mapPoints      = new List <PointD>();
     _ellipses       = new List <Ellipse>();
     NewPolygon();
     initAllBorder();
     this.ToolTip = "雷达区域";
     initFronRegion(region);
 }
示例#6
0
 private void initFronRegion(RadarRegion region)
 {
     if (region == null)
     {
         return;
     }
     PlotStatus = PlottingStatus.编辑模式;
     RadarArea  = region;
     UpdateToolTip();
     Push(region.Polygon);
     this.ToolTip = region.Name;
 }
示例#7
0
 private void OnSavingByString()
 {
     if (_importAreaByStringClient != null)
     {
         RadarRegion region = new RadarRegion()
         {
             Name = _importAreaByStringClient.Heading, Polygon = _importAreaByStringClient.Polygon, IsMask = true
         };
         importNewRadarArea(region);
         initListView();
         SelectedIndex(radarAreasListView.Items.Count - 1);
         centeredRadarArea();
         _importAreaByStringClient.OnSaving -= OnSavingByString;
         _importAreaByStringClient.Close();
         _importAreaByStringClient = null;
     }
 }
示例#8
0
        private static IEnumerable <RadarRegionInfo> getRegions(SqlConnection con)
        {
            string sqlCmd = "select * from [DBT_FEATURE] where Type='LDZBQ'or Type='LDBWDQ'";

            using (SqlDataAdapter sda = new SqlDataAdapter(sqlCmd, con))
            {
                DataTable dt = new DataTable();
                sda.Fill(dt);
                foreach (DataRow dr in dt.Rows)
                {
                    string shape = dr["Shape"] as string;
                    string name  = dr["Name"] as string;
                    string type  = dr["Type"] as string;
                    if (shape != null && name != null && type != null)
                    {
                        GeoAreaShape gas = null;
                        try
                        {
                            gas = GeometryShape.Parse(shape) as GeoAreaShape;
                        }
                        catch
                        {
                            gas = null;
                        }

                        if (gas != null && gas.Polygon.Points.Count > 0)
                        {
                            string relatedRadar = string.Empty;
                            object idObj        = dr["Id"];
                            if (idObj is int)
                            {
                                relatedRadar = getRelatedRadar(con, (int)idObj);
                            }

                            RadarRegion region = new RadarRegion();
                            region.Name           = name;
                            region.Polygon        = gas.Polygon.Points[0].Points.Select(pt => new Seecool.Radar.Unit.PointD(pt.X, pt.Y)).ToArray();
                            region.IsMask         = type.ToUpper() == "LDZBQ";
                            region.ManualIdenfity = type.ToUpper() == "LDBWDQ";
                            yield return(new RadarRegionInfo(region, relatedRadar));
                        }
                    }
                }
            }
        }
        private void updateRegion(string radarName, RadarRegion region)
        {
            for (int i = 0; i < Data.Count; i++)
            {
                if (Data.PlottingAreas[i].RadarArea.Name == region.Name)
                {
                    Data.PlottingAreas[i].AddConfigRadar(radarName);//关联
                    return;
                }
            }
            //未找到
            int selectedIndex = SelectedIndex;
            var plotArea      = new PlottingArea(Locator, region);

            plotArea.AddConfigRadar(radarName);
            Add(plotArea);
            SelectedIndex = selectedIndex;
        }
示例#10
0
        /// <summary>
        /// 拷贝region
        /// </summary>
        /// <param name="resource">非空</param>
        /// <returns></returns>
        public static RadarRegion Copy(RadarRegion resource)
        {
            RadarRegion region = new RadarRegion()
            {
                Name           = resource.Name,
                IsMask         = resource.IsMask,
                ManualIdenfity = resource.ManualIdenfity,
                PassThrough    = resource.PassThrough,
            };
            List <Seecool.Radar.Unit.PointD> points = new List <Seecool.Radar.Unit.PointD>();

            if (resource.Polygon != null)
            {
                for (int i = 0; i < resource.Polygon.Length; i++)
                {
                    points.Add(resource.Polygon[i]);
                }
            }
            region.Polygon = points.ToArray();
            return(region);
        }
 public static RadarRegion GetRegion(string regionString)
 {
     char[]   ch    = new char[] { ',', ' ', '\r', '\n' };
     string[] datas = regionString.Split(ch, StringSplitOptions.RemoveEmptyEntries);
     if (regionString != null)
     {
         int         index  = 0;
         RadarRegion region = new RadarRegion()
         {
             Name = datas[index++], IsMask = true
         };
         var points = new Seecool.Radar.Unit.PointD[(datas.Length - 1) / 2];
         for (int i = 0; i < points.Length; i++)
         {
             points[i].X = double.Parse(datas[index++]);
             points[i].Y = double.Parse(datas[index++]);
         }
         region.Polygon = points;
         return(region);
     }
     return(null);
 }
示例#12
0
 public RadarRegionInfo(RadarRegion region, string relateRadar)
 {
     Region      = region;
     RelateRadar = relateRadar;
 }
示例#13
0
        private void addRadarRegion(RadarRegion region)
        {
            var plotArea = new PlottingArea(_radarAreas.Locator, region);

            _radarAreas.Add(plotArea);
        }
示例#14
0
 private void importNewRadarArea(RadarRegion region)
 {
     addRadarRegion(region);
     linkedAllRadar();
 }