예제 #1
0
 /// <summary>
 /// 构造器
 /// </summary>
 /// <param name="form">父窗体</param>
 /// <param name="radar">雷达信息对象</param>
 public DataFrameMessages(FormDisplay form, Radar radar)
 {
     this.ParentForm          = form;
     this.Radar               = radar;
     this.RadarState          = new RadarState();
     this.CurrentSensorMode   = SensorMode.Cluster;
     this.ListBuffer_Cluster  = new List <ClusterGeneral>();
     this.ListTrigger_Cluster = new List <ClusterGeneral>();
     this.ListBuffer_Object   = new List <ObjectGeneral>();
     this.ListTrigger_Object  = new List <ObjectGeneral>();
     this.ThreadCheck         = new Thread(new ThreadStart(this.CheckIfRadarsWorking))
     {
         IsBackground = true
     };
     this.ThreadCheck.Start();
 }
예제 #2
0
        /// <summary>
        /// 构造器
        /// </summary>
        /// <param name="form">父窗体</param>
        /// <param name="radar">雷达信息对象</param>
        public DataFrameMessages(FormDisplay form, Radar radar)
        {
            this.ParentForm = form;
            this.Radar      = radar;
            this.Flags      = new List <bool>()
            {
                false, false, false, false, false, false, false, true, true
            };
            this.RadarState = new RadarState();
            if (this.Radar != null)
            {
                this.Radar.RadarState = this.RadarState;
                this.limit_factor     = this.Radar.GroupType == RadarGroupType.Feet ? 10 : 1;
            }
            this.CurrentSensorMode        = SensorMode.Cluster;
            this.ThreatLevelBinary        = "00";
            this.ListBuffer_Cluster       = new List <ClusterGeneral>();
            this.ListBuffer_Cluster_Other = new List <ClusterGeneral>();
            this.ListTrigger_Cluster      = new List <ClusterGeneral>();
            this.ListBuffer_Object        = new List <ObjectGeneral>();
            this.ListBuffer_Object_Other  = new List <ObjectGeneral>();
            this.ListTrigger_Object       = new List <ObjectGeneral>();
            //this.ThreatLevelArray = new char[] { '0', '0' };
            this.ThreadCheck = new Thread(new ThreadStart(this.CheckIfRadarsWorking))
            {
                IsBackground = true
            };

            if (this.Radar != null)
            {
                this.IsShore  = this.Radar.GroupType == RadarGroupType.Shore;                                //是否为岸基雷达
                this.Flags[4] = this.Radar.GroupType == RadarGroupType.Arm && this.Radar.Name.Contains("陆"); //是否为大臂陆侧雷达
                this.Flags[6] = this.Radar.GroupType == RadarGroupType.Feet;                                 //是否为门腿雷达
                ////根据雷达所在位置给黄标线距离加上符号,用于门腿雷达坐标过滤黄标线之外的点
                //string name = this.Radar.Name;
                //int r = (name.Contains("海") && name.Contains("南")) || (name.Contains("陆") && name.Contains("北")) ? 1 : -1;
                //this.outer *= r;
                //this.inner *= r;
            }
            this.ThreadCheck.Start();
        }
예제 #3
0
파일: Form1.cs 프로젝트: ssozinov/bomberSoz
        private void MainForm_Load(object sender, EventArgs e)
        {
            BufferedGraphicsContext currentContext;
            BufferedGraphics        myBuffer;

            SoundPlayer mainSound = new SoundPlayer(Resources.go_goom);

            //  mainSound.PlaySync();

            currentContext = BufferedGraphicsManager.Current;

            myBuffer = currentContext.Allocate(this.CreateGraphics(),
                                               this.DisplayRectangle);
            var mapManager = new MapManager(ConfigurationManager.AppSettings["pathToMapDirectory"], ConfigurationManager.AppSettings["pathToMapFile"]);
            var map        = new FormMap(int.Parse(ConfigurationManager.AppSettings["widthField"]), int.Parse(ConfigurationManager.AppSettings["heightField"]), int.Parse(ConfigurationManager.AppSettings["timeToBoom"]));
            var Bomber     = new BomberSoz.Model.Bomber(int.Parse(ConfigurationManager.AppSettings["liveCount"]), map.FirstPositionBomber);

            this.Size = new System.Drawing.Size((map.Width + 1) * ImagePath.IMAGE_SIZE + 20, (map.Height + 1) * ImagePath.IMAGE_SIZE + 150);
            map.Load(mapManager.GetFirstMap());
            map.SetUpgradeOnMap(1, 1, 1);
            this.DoubleBuffered = true;
            displayForm         = new FormDisplay(map, this, this.CreateGraphics(), myBuffer, Bomber, mainSound);
            gamepadForm         = new FormGamePad();
            mC = new MotionController(displayForm, gamepadForm, map, Bomber, mapManager);

            mC.SetPositionForPerson(2, 1);
            mC.SetPositionForPerson(3, 2);
            mC.SetPositionForPerson(4, 1);

            System.Diagnostics.Stopwatch sw = new Stopwatch();
            sw.Start();

            sw.Stop();
            Logging.WriteTrace("Первая отрисовка" + (sw.ElapsedMilliseconds / 100.0).ToString());
            Task.Run(() => mC.Start());
        }
예제 #4
0
        static void Main(string[] args)
        {
            BaseFunc.InitConfigs(); //配置初始化

            #region 测试
            //int t = '0' - '0';

            //double x = 1, y = 1, z = 1;
            //int m = 1;
            //double d = Math.Sqrt((Math.Sign(4 - m) == 1 ? 1 : 0) * Math.Pow(x, 2) + (Math.Sign(3 - m) == 1 ? 1 : 0) * Math.Pow(y, 2) + (Math.Sign(2 - m) == 1 ? 1 : 0) * Math.Pow(z, 2));
            ////int level = BaseFunc.GetThreatLevelByValue(-1);
            //int temp = 1;

            //Radar radar = new Radar() { DegreeYoz = -90, DegreeXoy = 0, DegreeXoz = -60, DegreeGeneral = 180 };
            //List<ObjectGeneral> list = new List<ObjectGeneral>() { new ObjectGeneral(null, radar) { DistLong = 2, DistLat = 2, Color = Color.FromArgb(255, 255, 0) }, new ObjectGeneral(null, radar) { DistLong = 5, DistLat = 5, Color = Color.FromArgb(255, 255, 0) }, new ObjectGeneral(null, radar) { DistLong = 3, DistLat = 3, Color = Color.FromArgb(255, 255, 0) }, new ObjectGeneral(null, radar) { DistLong = 1, DistLat = 1, Color = Color.FromArgb(255, 255, 0) } };
            //list.Sort((o1, o2) => o1.DistanceToBorder.CompareTo(o2.DistanceToBorder));
            //////BaseFunc.WriteMessagesToFile<ObjectGeneral>(list, false);
            ////BaseFunc.WriteMessagesToFile<ObjectGeneral>(list, true);
            //return;

            //string base64 = Convert.ToBase64String(File.ReadAllBytes("ars_coor.png")); //将文件转换为base64编码
            //File.WriteAllBytes("ars_coor1.png", Convert.FromBase64String(base64));

            //List<SensorMessage> list = new List<SensorMessage>();
            //list.Add(new ClusterGeneral());
            //list.Add(new ClusterGeneral());
            //list.Add(new ObjectGeneral());
            //list.Add(new ObjectGeneral());
            //int count1 = list.Count(m => m is ClusterGeneral), count2 = list.Count(m => m is ObjectGeneral);
            //List<ClusterGeneral> list = new List<ClusterGeneral>();
            //ClusterGeneral o = new ClusterGeneral();
            //o = (dynamic)o;

            //list.Add((dynamic)o);
            //ClusterGeneral g = Converter.Convert<ClusterGeneral>(o);
            //int temp = 1;

            //string test = "\r\nsometest".TrimEnd('\r', '\n');
            //test = "\r\n".TrimEnd('\r', '\n');

            //string t = Base.StartupPath;
            //byte r, g, b;
            //r = (g = (b = 120));
            //int rgb = ((int)r << 16 | (int)g << 8 | (int)b);

            //List<SensorMessage> messages = new List<SensorMessage>();
            //messages.Add(new ClusterGeneral());
            //messages.Add(new ClusterStatus());
            //foreach (var message in messages)
            //{
            //    Type type = message.GetType();
            //    string temp = message.GetType().ToString();
            //    int t = 1;
            //}

            //char[] cs = "05 00 00 06 00 0D 04 BF 43 10 00 00 00".ToCharArray();
            //byte b = Convert.ToByte("11001101", 2);
            //int msg_0;
            //byte sensor = BaseFunc.GetSensorIdByMessageId(0x721, out msg_0);
            //SensorMessageId_0 messageid = (SensorMessageId_0)msg_0;
            //string message = messageid.GetDescription();

            //int temp = 1;
            #endregion


            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            Form form;

            form = new FormMain();
            string argstring = args == null ? string.Empty : ";" + string.Join(";", args).ToUpper() + ";";
            //if (args != null && args.Contains(single"))
            if (argstring.Contains(";SINGLE;"))
            {
                form = new FormDisplay();
            }

            //Application.Run(new FormMain());
            Application.Run(form);
        }
예제 #5
0
 /// <summary>
 /// 构造器
 /// </summary>
 /// <param name="form">父窗体</param>
 public DataFrameMessages(FormDisplay form) : this(form, null)
 {
 }