コード例 #1
0
        private List<TtGroup> GetUpgradeGroups()
        {
            List<TtGroup> groups = new List<TtGroup>();

            StringBuilder query = new StringBuilder();
            query.AppendFormat("SELECT {0}, {1}, {2}, {3}, {4} from {5} ",
                TwoTrailsSchema.GroupSchema.CN,
                TwoTrailsSchema.GroupSchema.Name,
                TwoTrailsSchema.GroupSchema.Accuracy,
                TwoTrailsSchema.GroupSchema.Description,
                TwoTrailsSchema.GroupSchema.Type,
                TwoTrailsSchema.GroupSchema.TableName);

            SQLiteCommand cmd = _dbConnection.CreateCommand();

            try
            {
                cmd.CommandText = query.ToString();

                TtGroup group = new TtGroup();
                SQLiteDataReader reader = cmd.ExecuteReader();
                while (reader.Read())
                {
                    group.CN = reader.GetString(0);
                    group.SetGroupName(reader.GetString(1), null);
                    if (!reader.IsDBNull(2))
                        group.SetGroupManualAccuracy(reader.GetDouble(2), null);
                    if (!reader.IsDBNull(3))
                        group.Description = reader.GetString(3);
                    if (!reader.IsDBNull(4))
                    {
                        group.GroupType = (GroupType)Enum.Parse(typeof(GroupType), reader.GetString(4), true);
                    }

                    //group.Init(GetPointCNsInGroup(group.CN));

                    groups.Add(group);
                    group = new TtGroup();
                }
            }
            catch (Exception ex)
            {
                TtUtils.WriteError(ex.Message, "DataAccessUpgrader:GetGroups", ex.StackTrace);
            }
            finally
            {
                cmd.Dispose();
            }

            return groups;
        }
コード例 #2
0
        private void CreateWalkPoint(NmeaBurst b)
        {
            try
            {
                if (WalkGroup == null)
                {
                    WalkGroup = new TtGroup();
                    WalkGroup.SetGroupName(String.Format("Walk_{0}", WalkGroup.CN.Truncate(8)), null);

                    DAL.InsertGroup(WalkGroup);
                }

                if (CurrentPoint != null)
                {
                    DAL.InsertPoint(CurrentPoint);
                    DAL.SaveNmeaBurst(CurrentNmea, CurrentPoint.CN);

                    LastPoint = CurrentPoint;

                    btnOk.GuiInvoke(() => { btnOk.Enabled = true; });
                }
            }
            catch (Exception ex)
            {
                TtUtils.WriteError(ex.Message, "WalkFormLogic:CreateWalkPoint-Save Current Point", ex.StackTrace);
            }

            LastNmea = CurrentNmea;
            CurrentNmea = b;

            if (SetupPoint())
            {
                try
                {
                    CurrentPoint.UnAdjX = b._X;
                    CurrentPoint.UnAdjY = b._Y;
                    CurrentPoint.UnAdjZ = b._Z;
                    //CurrentPoint.X = b._X;
                    //CurrentPoint.Y = b._Y;
                    //CurrentPoint.Z = b._Z;
                    CurrentPoint.Time = DateTime.Now;
                    CurrentPoint.MetaDefCN = _currmeta.CN;
                    CurrentPoint.RMSEr = Values.Settings.DeviceOptions.MIN_POINT_ACCURACY;

                    b._Used = true;

                    if (_sound)
                    {
                        try
                        {
                            player.Play();
                        }
                        catch
                        {

                        }
                    }

                    new Thread(()=>
                        {
                            if(TtUtils.PointHasValue(CurrentPoint) || !Values.Settings.ProjectOptions.DropZero)
                                DrawSavePointIcon();
                            else
                                CurrentPoint = LastPoint;
                        }).Start();
                }
                catch (Exception ex)
                {
                    TtUtils.WriteError(ex.Message, "WalkFormLogic:CreateWalkPoint", ex.StackTrace);
                }
            }
        }
コード例 #3
0
        private void quondamInfoControl1_PointsRetraced2()
        {
            SavePoint();

            using (QuondamRetraceForm form = new QuondamRetraceForm(DAL, quondamInfoControl1.PointListIndex, quondamInfoControl1.PolyListIndex))
            {
                if (form.ShowDialog() == DialogResult.OK)
                {
                    TtGroup qg = new TtGroup();
                    qg.SetGroupName(String.Format("Quondams_{0}", qg.CN.Truncate(8)), null);

                    DAL.InsertGroup(qg);
                    //Values.GroupManager.AddGroup(qg, DAL);

                    foreach(TtPoint p in form.FinalPoints)
                    {

                        p.GroupCN = qg.CN;
                        p.GroupName = qg.Name;
                        //qg.AddPointToGroup(p);
                        CreateNewPoint(OpType.Quondam, false, true);

                        ((QuondamPoint)_UpdatedPoint).ParentPoint = p;
                        _dirty = true;
                    }

                    //Values.GroupManager.SaveGroup(qg.CN, DAL);

                    ChangePolygon();
                }
            }
        }