コード例 #1
0
ファイル: mainForm.cs プロジェクト: coffeemore6/AADS-Polygon
        private void radarHandler_RadarCreate(RadarSite radar)
        {
            GMarkerRadar marker = new GMarkerRadar(radar);
            GMarkerRect  rect   = new GMarkerRect(marker);

            radarOverlay.Markers.Add(marker);
            radarOverlay.Markers.Add(rect);
            radarMarkers.Add(radar.Name, rect);
        }
コード例 #2
0
ファイル: mainForm.cs プロジェクト: coffeemore6/AADS-Polygon
        private void trackHandler_TrackUpdate(TrackData item)
        {
            GMarkerRect  rect   = trackMarkers[item.Key];
            GMarkerTrack marker = rect.InnerMarker as GMarkerTrack;

            rect.SetPosition(item.Position);
            marker.Track = item;
            mainMap.Invalidate();
        }
コード例 #3
0
ファイル: mainForm.cs プロジェクト: coffeemore6/AADS-Polygon
        private void trackHandler_TrackCreate(TrackData item)
        {
            MessageBox.Show("Track Event Add");
            GMarkerTrack marker = new GMarkerTrack(item);
            GMarkerRect  rect   = new GMarkerRect(marker);

            trackOverlay.Markers.Add(marker);
            trackOverlay.Markers.Add(rect);
            trackMarkers.Add(item.Key, rect);
        }
コード例 #4
0
ファイル: mainForm.cs プロジェクト: coffeemore6/AADS-Polygon
        private void trackHandler_TrackRemove(TrackData item)
        {
            GMarkerRect  rect   = trackMarkers[item.Key];
            GMarkerTrack marker = rect.InnerMarker as GMarkerTrack;

            trackOverlay.Markers.Remove(marker);
            trackOverlay.Markers.Remove(rect);
            markerOverlay.Markers.Remove(marker);
            rect.Dispose();
            trackMarkers.Remove(item.Key);
        }
コード例 #5
0
ファイル: mainForm.cs プロジェクト: coffeemore6/AADS-Polygon
 private void trackHandler_TrackClear()
 {
     trackHandler.Tracks.ForEach(x =>
     {
         GMarkerRect rect    = trackMarkers[x.Key];
         GMarkerTrack marker = rect.InnerMarker as GMarkerTrack;
         trackOverlay.Markers.Remove(marker);
         trackOverlay.Markers.Remove(rect);
         rect.Dispose();
     });
     trackMarkers.Clear();
 }
コード例 #6
0
ファイル: mainForm.cs プロジェクト: coffeemore6/AADS-Polygon
        private void radarHandler_RadarRemove(RadarSite radar)
        {
            GMarkerRect  rect   = radarMarkers[radar.Name];
            GMarkerRadar marker = rect.InnerMarker as GMarkerRadar;

            if (marker.IsRadiusShow)
            {
                radarOverlay.Polygons.Remove(marker.RadiusPolygon);
            }
            trackOverlay.Markers.Remove(marker);
            trackOverlay.Markers.Remove(rect);
            rect.Dispose();
            radarMarkers.Remove(radar.Name);
        }
コード例 #7
0
ファイル: mainForm.cs プロジェクト: coffeemore6/AADS-Polygon
        private void radarHandler_RadarUpdate(RadarSite radar)
        {
            GMarkerRect  rect   = radarMarkers[radar.Name];
            GMarkerRadar marker = rect.InnerMarker as GMarkerRadar;

            radarOverlay.Polygons.Remove(marker.RadiusPolygon);
            marker.RenewRadius();
            if (marker.IsRadiusShow)
            {
                radarOverlay.Polygons.Add(marker.RadiusPolygon);
            }
            rect.SetPosition(radar.Position);
            mainMap.Invalidate();
        }
コード例 #8
0
ファイル: mainForm.cs プロジェクト: coffeemore6/AADS-Polygon
 private void radarHandler_RadarClear()
 {
     radarHandler.Radars.ForEach(x =>
     {
         GMarkerRect rect    = radarMarkers[x.Name];
         GMarkerRadar marker = rect.InnerMarker as GMarkerRadar;
         if (marker.IsRadiusShow)
         {
             radarOverlay.Polygons.Remove(marker.RadiusPolygon);
         }
         radarOverlay.Markers.Remove(marker);
         radarOverlay.Markers.Remove(rect);
         rect.Dispose();
     });
     radarMarkers.Clear();
 }
コード例 #9
0
ファイル: mainForm.cs プロジェクト: coffeemore6/AADS-Polygon
        private void mainForm_Load(object sender, EventArgs e)
        {
            this.Size = new Size(1600, 900);
            timeNow.Start();
            timerCheckConnection.Start();
            timerFakerSimulate.Start();
            updateMinMap();
            updateCmbMapMode();
            cmbMapMode.SelectedIndex = 0;
            panelRight.Height        = this.Height - panelControl.Height - panelTop.Height - panelBottom.Height;
            panelRight.Location      = new Point(1950, 93);
            label27Location          = new Point(this.Width - label27.Width, label27.Location.Y);
            mainMap.Overlays.Add(previewOverlay);
            mainMap.Overlays.Add(polygonOverlay);
            radarHandler.Create(new RadarSite
            {
                Name     = "TRML",
                Type     = RadarSiteType.TRML,
                Position = new PointLatLng(14.94561195, 102.0929003),
                Radius   = 240
            });
            radarHandler.Create(new RadarSite
            {
                Name     = "DR172ADV",
                Type     = RadarSiteType.DR172ADV,
                Position = new PointLatLng(14.2255556, 100.7208333),
                Radius   = 240
            });


            try
            {
                com.Open();
                com.Close();
            }
            catch (MySqlException)
            {
                isConnected = false;
            }
            if (isConnected)
            {
                com.Open();
                string sql = "SELECT max(airport_id) FROM airport " +
                             "UNION SELECT max(city_id) FROM city " +
                             "UNION SELECT max(fireunit_id) FROM fireunit " +
                             "UNION SELECT max(fp_id) FROM fixedpoint" +
                             " UNION SELECT max(landmark_id) FROM landmark " +
                             "UNION SELECT max(vital_id) FROM vitalasset; ";
                MySqlDataAdapter adapter = new MySqlDataAdapter(sql, com);
                DataSet          dataSet = new DataSet();
                adapter.Fill(dataSet);
                foreach (DataTable table in dataSet.Tables)
                {
                    foreach (DataRow row in table.Rows)
                    {
                        foreach (object item in row.ItemArray)
                        {
                            string str = item.ToString();
                            if (str != "")
                            {
                                if (str.Substring(0, 2) == "AP")
                                {
                                    AirportCreation.AutoIncrementID = Int32.Parse(str.Substring(2));
                                }
                                else if (str.Substring(0, 2) == "CI")
                                {
                                    CityCreation.AutoIncrementID = Int32.Parse(str.Substring(2));
                                }
                                else if (str.Substring(0, 2) == "FU")
                                {
                                    FireUnitCreation.AutoIncrementID = Int32.Parse(str.Substring(2));
                                }
                                else if (str.Substring(0, 2) == "FP")
                                {
                                    FixedPointCreation.AutoIncrementID = Int32.Parse(str.Substring(2));
                                }
                                else if (str.Substring(0, 2) == "LM")
                                {
                                    LandmarkCreation.AutoIncrementID = Int32.Parse(str.Substring(2));
                                }
                                else if (str.Substring(0, 2) == "VA")
                                {
                                    VitalAssetCreation.AutoIncrementID = Int32.Parse(str.Substring(2));
                                }
                            }
                        }
                    }
                }
                string           sqlGet     = "SELECT * FROM markers";
                MySqlDataAdapter adapterGet = new MySqlDataAdapter(sqlGet, com);
                DataSet          dataSet1   = new DataSet();
                adapterGet.Fill(dataSet1);
                foreach (DataTable table in dataSet1.Tables)
                {
                    foreach (DataRow row in table.Rows)
                    {
                        string      str   = row[0].ToString();
                        PointLatLng point = PositionConverter.ParsePointFromString(row[1].ToString() + "," + row[2].ToString());
                        if (str.Substring(0, 2) == "AP")
                        {
                            string       sqlGetMK = "SELECT * FROM airport INNER JOIN country ON airport_country = country_id WHERE airport_id = @ID";
                            MySqlCommand cmd      = new MySqlCommand(sqlGetMK, com);
                            cmd.Parameters.AddWithValue("ID", str);
                            MySqlDataReader mySqlDataReader = cmd.ExecuteReader();

                            while (mySqlDataReader.Read())
                            {
                                Image       image   = Image.FromFile("Images/icon/Airport.png");
                                GMarker     marker  = new GMarker(point, mySqlDataReader["airport_name"].ToString(), image);
                                GMarkerRect rect    = new GMarkerRect(marker);
                                Airport     airport = new Airport(mySqlDataReader["airport_id"].ToString(), mySqlDataReader["country_name"].ToString(), mySqlDataReader["airport_name"].ToString(),
                                                                  mySqlDataReader["airport_is_international"].ToString() == "true" ? 1 : 0, mySqlDataReader["airport_icao"].ToString(), mySqlDataReader["airport_iata"].ToString(), point);
                                detailMarkers.Add(marker, airport);
                                markerOverlay.Markers.Add(marker);
                                markerOverlay.Markers.Add(rect);
                            }
                            mySqlDataReader.Close();
                        }
                        else if (str.Substring(0, 2) == "CI")
                        {
                            string       sqlGetMK = "SELECT * FROM city WHERE city_id = @ID";
                            MySqlCommand cmd      = new MySqlCommand(sqlGetMK, com);
                            cmd.Parameters.AddWithValue("ID", str);
                            MySqlDataReader mySqlDataReader = cmd.ExecuteReader();

                            while (mySqlDataReader.Read())
                            {
                                Image       image  = Image.FromFile("Images/icon/City.png");
                                GMarker     marker = new GMarker(point, mySqlDataReader["city_name"].ToString(), image);
                                GMarkerRect rect   = new GMarkerRect(marker);
                                City        city   = new City(mySqlDataReader["city_id"].ToString(), mySqlDataReader["city_name"].ToString(), mySqlDataReader["city_label"].ToString(),
                                                              row[3].ToString(), point);
                                detailMarkers.Add(marker, city);
                                markerOverlay.Markers.Add(marker);
                                markerOverlay.Markers.Add(rect);
                            }
                            mySqlDataReader.Close();
                        }
                        else if (str.Substring(0, 2) == "FU")
                        {
                            // =============== NOT DONE YET ================
                            //  string sqlGetMK = "SELECT * FROM fireunit INNER JOIN weaponbattery ON weaponbattery_id = weaponbattery.wb_id WHERE fireunit_id = @ID";
                            // MySqlCommand cmd = new MySqlCommand(sqlGetMK, com);
                            // cmd.Parameters.AddWithValue("ID", str);
                            // MySqlDataReader mySqlDataReader = cmd.ExecuteReader();

                            // while (mySqlDataReader.Read())
                            // {
                            //     Image image = Image.FromFile("Images/icon/FireUnit.png");
                            //     GMarker marker = new GMarker(point, mySqlDataReader["fireunit_id"].ToString(), image);
                            //     GMarkerRect rect = new GMarkerRect(marker);
                            //     City city = new City(mySqlDataReader["city_id"].ToString(), mySqlDataReader["city_name"].ToString(), mySqlDataReader["city_label"].ToString(),
                            //         row[3].ToString(),point);
                            //     detailMarkers.Add(marker, city);
                            //     markerOverlay.Markers.Add(marker);
                            //     markerOverlay.Markers.Add(rect);
                            // }
                            // mySqlDataReader.Close();
                        }
                        else if (str.Substring(0, 2) == "FP")
                        {
                            // =============== NOT DONE YET ================
                            // string sqlGetMK = "SELECT * FROM fixedpoint WHERE fixedpoint_id = @ID";
                            // MySqlCommand cmd = new MySqlCommand(sqlGetMK, com);
                            // cmd.Parameters.AddWithValue("ID", str);
                            // MySqlDataReader mySqlDataReader = cmd.ExecuteReader();

                            // while (mySqlDataReader.Read())
                            // {
                            //     Image image = Image.FromFile("Images/icon/FireUnit.png");
                            //     GMarker marker = new GMarker(point, mySqlDataReader["fireunit_id"].ToString(), image);
                            //     GMarkerRect rect = new GMarkerRect(marker);
                            //     City city = new City(mySqlDataReader["city_id"].ToString(), mySqlDataReader["city_name"].ToString(), mySqlDataReader["city_label"].ToString(),
                            //         row[3].ToString(), point);
                            //     detailMarkers.Add(marker, city);
                            //     markerOverlay.Markers.Add(marker);
                            //     markerOverlay.Markers.Add(rect);
                            // }
                            // mySqlDataReader.Close();
                        }
                        else if (str.Substring(0, 2) == "LM")
                        {
                            string       sqlGetMK = "SELECT * FROM landmark WHERE landmark_id = @ID";
                            MySqlCommand cmd      = new MySqlCommand(sqlGetMK, com);
                            cmd.Parameters.AddWithValue("ID", str);
                            MySqlDataReader mySqlDataReader = cmd.ExecuteReader();

                            while (mySqlDataReader.Read())
                            {
                                Image image = null;
                                if (mySqlDataReader["landmark_type"].ToString() == "พระราชวัง")
                                {
                                    image = Image.FromFile("Images/landmark/040-royal palace.png");
                                }
                                else if (mySqlDataReader["landmark_type"].ToString() == "วัด")
                                {
                                    image = Image.FromFile("Images/landmark/039-temple.png");
                                }
                                else if (mySqlDataReader["landmark_type"].ToString() == "สถานีตำรวจ")
                                {
                                    image = Image.FromFile("Images/landmark/026-police station.png");
                                }
                                else if (mySqlDataReader["landmark_type"].ToString() == "โรงพยาบาล")
                                {
                                    image = Image.FromFile("Images/landmark/014-hospital.png");
                                }
                                else if (mySqlDataReader["landmark_type"].ToString() == "โรงเรียน / มหาวิทยาลัย")
                                {
                                    image = Image.FromFile("Images/landmark/011-education.png");
                                }

                                GMarker     marker   = new GMarker(point, mySqlDataReader["landmark_label"].ToString(), image);
                                GMarkerRect rect     = new GMarkerRect(marker);
                                LandMark    landMark = new LandMark(mySqlDataReader["landmark_id"].ToString(), mySqlDataReader["landmark_name"].ToString(), mySqlDataReader["landmark_label"].ToString(),
                                                                    point, mySqlDataReader["landmark_type"].ToString(), row[3].ToString());
                                detailMarkers.Add(marker, landMark);
                                markerOverlay.Markers.Add(marker);
                                markerOverlay.Markers.Add(rect);
                            }
                            mySqlDataReader.Close();
                        }
                        else if (str.Substring(0, 2) == "VA")
                        {
                            string       sqlGetMK = "SELECT * FROM vitalasset INNER JOIN province ON FK_province_id = province_id INNER JOIN fireunit ON FK_unit_id = fireunit_id WHERE vital_id = @ID";
                            MySqlCommand cmd      = new MySqlCommand(sqlGetMK, com);
                            cmd.Parameters.AddWithValue("ID", str);
                            MySqlDataReader mySqlDataReader = cmd.ExecuteReader();

                            while (mySqlDataReader.Read())
                            {
                                Image       image      = Image.FromFile("Images/icon/VitalAsset.png");
                                GMarker     marker     = new GMarker(point, mySqlDataReader["vital_name"].ToString(), image);
                                GMarkerRect rect       = new GMarkerRect(marker);
                                VitalAsset  vitalAsset = new VitalAsset(mySqlDataReader["vital_id"].ToString(), mySqlDataReader["vital_name"].ToString(), mySqlDataReader["vital_type"].ToString(),
                                                                        Int32.Parse(mySqlDataReader["vital_priority"].ToString()), mySqlDataReader["province_name"].ToString(), mySqlDataReader["vital_size"].ToString(),
                                                                        mySqlDataReader["FK_unit_id"].ToString(), mySqlDataReader["fireunit_status"].ToString(), mySqlDataReader["vital_responses_person"].ToString(), point);
                                detailMarkers.Add(marker, vitalAsset);
                                markerOverlay.Markers.Add(marker);
                                markerOverlay.Markers.Add(rect);
                            }
                            mySqlDataReader.Close();
                        }
                    }
                }
                com.Close();
            }
        }