Ejemplo n.º 1
0
 public Take5Point(Take5Point p)
     : base(p)
 {
     _op = TwoTrails.Engine.OpType.Take5;
 }
        private bool SetupPoint()
        {
            CurrentPoint = new Take5Point();
            lastPointSaved = false;

            try
            {
                if(LastPoint != null)
                    CurrentPoint.PID = PointNaming.NamePoint(LastPoint, Polygon);
                else
                    CurrentPoint.PID = PointNaming.NameFirstPoint(Polygon);

                CurrentPoint.PolyCN = Polygon.CN;
                CurrentPoint.PolyName = Polygon.Name;
                CurrentPoint.OnBnd = OnBound;
                CurrentPoint.Index = _index;
                CurrentPoint.GroupCN = Values.MainGroup.CN;
                CurrentPoint.GroupName = Values.MainGroup.Name;
                _index++;
            }
            catch (Exception ex)
            {
                TtUtils.WriteError(ex.Message, "Take5Form:SetupPoint", ex.StackTrace);
                return false;
            }

            this.GuiInvoke(() => {
                txtPID.Text = CurrentPoint.PID.ToString();
                txtComment.Text = CurrentPoint.Comment;
            });

            return true;
        }
        public void Init(TtPolygon poly, DataAccessLayer dal, TtMetaData meta, TtPoint currentPoint, int currIndex)
        {
            this.Icon = Properties.Resources.Map;
            TtUtils.ShowWaitCursor();
            #if (PocketPC || WindowsCE || Mobile)
            lblLabel.Text = "Take " + Values.Settings.DeviceOptions.Take5NmeaAmount.ToString();
            #endif
            btnCapture.Text = "Take " + Values.Settings.DeviceOptions.Take5NmeaAmount.ToString();
            this.Text = "Take " + Values.Settings.DeviceOptions.Take5NmeaAmount.ToString() + " Point Capture";

            Values.GPSA.BurstReceived += GPSA_BurstReceived;
            Values.GPSA.InvalidStringFound += GPSA_InvalidStringFound;
            Values.GPSA.ComTimeout += GPSA_ComTimeout;
            Values.GPSA.GpsStarted += GPSA_GpsStarted;
            Values.GPSA.GpsEnded += GPSA_GpsEnded;
            Values.GPSA.GpsError += GPSA_GpsError;

            travInfoControl1.UseLaser = false;

            Polygon = poly;
            DAL = dal;
            CurrMeta = meta;

            logging = false;
            this.DialogResult = DialogResult.Cancel;
            OnBound = true;
            _index = 0;
            ignore = 0;

            progCapture.Value = 0;
            progCapture.Minimum = 0;
            progCapture.Maximum = Values.Settings.DeviceOptions.Take5NmeaAmount;

            logged = 0;
            _locked = true;

            CurrentNmea = new List<NmeaBurst>();
            LastNmea = new List<NmeaBurst>();
            CurrentPoint = null;

            _index = currIndex;
            LastPoint = currentPoint;

            gpsInfoAdvCtrl.SetZone(CurrMeta.Zone);
            gpsInfoAdvCtrl.StartControl();

            if (Values.GPSA.UsesFile && Values.Settings.DeviceOptions.GetGpsOnStart)
            {
                using (DeviceSetupForm dsf = new DeviceSetupForm())
                {
                    dsf.ShowDialog();
                }
            }

            T5Group = new TtGroup();
            T5Group.Name = String.Format("Take5_{0}", T5Group.CN.Truncate(8));
            T5Group.GroupType = GroupType.Take5;

            if(!Values.GPSA.IsBusy)
                Values.GPSA.OpenGps(Values.Settings.DeviceOptions.GpsComPort, Values.Settings.DeviceOptions.GpsBaud);
            TtUtils.HideWaitCursor();

            if (dal.GetPointCount(poly.CN) < 1)
            {
                checkMeta = true;
            }
        }
 private void DisplayTake5(Take5Point point)
 {
     walkInfoCtrl1.Visible = false;
     take5InfoCtrl1.Visible = false;     //use button to open
     gpsInfoControl1.MiscButtonText = "Take 5 Setup";
     gpsInfoControl1.ShowMiscButton = true;
     gpsInfoControl1.Visible = true;
     gpsInfoControl1.CurrentPoint = point;
     gpsInfoControl1.Meta = CurrMeta;
     travInfoControl1.Visible = false;
     quondamInfoControl1.Visible = false;
     actionsControl.MiscButtonText = "Take " + Values.Settings.DeviceOptions.Take5NmeaAmount.ToString();
     actionsControl.MiscButtonEnabled = true;
 }