Exemplo n.º 1
0
        /////////////////////////////////
        /////////////////////////////////
        private void openProjectToolStripMenuItem_Click(object sender, EventArgs e)
        {
            FileStream   fs = null;
            BinaryReader br = null;

            OpenFileDialog ofd = new OpenFileDialog();

            ofd.Filter           = "(All Files)|*.*";
            ofd.InitialDirectory = Application.StartupPath;

            if (ofd.ShowDialog() != DialogResult.OK)
            {
                return;
            }

            myProject.NewProject();
            fs = new FileStream(ofd.FileName, FileMode.Open);
            br = new BinaryReader(fs);

            int measuredPoints = br.ReadInt32();

            for (int ii = 0; ii < measuredPoints; ii++)
            {
                ShipData shipDataNew = new ShipData();
                shipDataNew.Read(br);
                myProject.AddMeasure(ref shipDataNew);
            }

            br.Close();
            fs.Close();
            mapForm.Invalidate();
        }
Exemplo n.º 2
0
        /////////////////////////////////
        public ShipData(ShipData shipDataIn)
        {
            gpsData    = new GpsData(shipDataIn.gpsData);
            gpsRefData = new GpsData(shipDataIn.gpsRefData);

            batery  = shipDataIn.batery;
            voltage = shipDataIn.voltage;
        }
Exemplo n.º 3
0
        /////////////////////////////////
        /////////////////////////////////
        public void AddMeasure(ref ShipData shipData)
        {
            shipDataArray.Add(shipData);
            DataRow dr = dataTable.NewRow();

            dr[0] = shipData.gpsData.timeStr;// DateTime.Now.ToString(@"HH\:mm\:ss");
            dr[1] = shipData.gpsRefData.lat.gpsStr + "|" + shipData.gpsRefData.lon.gpsStr;
            dr[2] = shipData.gpsData.lat.gpsStr + "|" + shipData.gpsData.lon.gpsStr;
            dr[3] = shipData.voltage;
            dr[4] = shipData.batery;
            dataTable.Rows.Add(dr);
            if (shipDataArray.Count == 1)
            {
                latMin     = shipData.gpsData.lat.gpsValue; latMax = latMin;
                lonMin     = shipData.gpsData.lon.gpsValue; lonMax = lonMin;
                voltageMin = shipData.voltage; voltageMax = voltageMin;
            }
            else
            {
                if (latMin > shipData.gpsData.lat.gpsValue)
                {
                    latMin = shipData.gpsData.lat.gpsValue;
                }
                if (latMax < shipData.gpsData.lat.gpsValue)
                {
                    latMax = shipData.gpsData.lat.gpsValue;
                }

                if (lonMin > shipData.gpsData.lon.gpsValue)
                {
                    lonMin = shipData.gpsData.lon.gpsValue;
                }
                if (lonMax < shipData.gpsData.lon.gpsValue)
                {
                    lonMax = shipData.gpsData.lon.gpsValue;
                }

                if (voltageMin > shipData.voltage)
                {
                    voltageMin = shipData.voltage;
                }
                if (voltageMax < shipData.voltage)
                {
                    voltageMax = shipData.voltage;
                }
            }
            voltageAbs = Math.Max(Math.Abs(voltageMin), Math.Abs(voltageMax));
        }
Exemplo n.º 4
0
        /////////////////////////////////
        /////////////////////////////////
        public void UpdateIsMeasuringData()
        {
            ShipData shipData = MainForm.myProject.GetShipData();

            //SŠ: 49°57' 45,55''
            lGpsLat.Text = shipData.gpsData.lat.gpsStr;

            /*"SŠ: "
             + shipData.gpsData.lat.gpsDegsStr + "°"
             + shipData.gpsData.lat.gpsMinutesStr + "'"
             + shipData.gpsData.lat.gpsSecondsStr + "''";*/
            //VD: 17°57' 45,55''
            lGpsLon.Text = shipData.gpsData.lon.gpsStr;

            lVoltage.Text = shipData.voltage.ToString() + " mV";//"0.000"

            lBatery.Text = shipData.batery.ToString("0.00") + " V";

            /*"VD: "
             + shipData.gpsData.lon.gpsDegsStr + "°"
             + shipData.gpsData.lon.gpsMinutesStr + "'"
             + shipData.gpsData.lon.gpsSecondsStr + "''";*/
        }