private void loadListbox(DataAccessLayer d) { dal = d; int w = lstPolygons.Width; lstPolygons.Columns.Add("Polygons", w / 4, HorizontalAlignment.Left); lstPolygons.Columns.Add("Points", w / 5,HorizontalAlignment.Left); lstPolygons.Columns.Add("Area (Ac)", -1, HorizontalAlignment.Left); /* lstPolygons.Columns.Add("Polygons", 100, HorizontalAlignment.Left); lstPolygons.Columns.Add("Points",50,HorizontalAlignment.Left); lstPolygons.Columns.Add("Area (Ac)", 70, HorizontalAlignment.Left); */ cboLabels.Items.Add("None"); cboLabels.Items.Add("All"); if(dal != null) { List<TtPolygon> polys = dal.GetPolygons(); allPolyCNs = new List<string>(); TtPolygon poly; for (int i = 0; i < polys.Count; i++) { poly = polys[i]; ListViewItem l = new ListViewItem(poly.Name); l.SubItems.Add(dal.GetPointCount(poly.CN).ToString()); //l.SubItems.Add((polys[i].Area / 1000).ToString()); l.SubItems.Add(TtUtils.ConvertMeters2ToAcres(poly.Area).ToString()); allPolyCNs.Add(poly.CN); if (i % 2 == 1) l.BackColor = Color.LightGray; lstPolygons.Items.Add(l); cboLabels.Items.Add(poly.Name); if (MapValues.mapPolyLabels == poly.CN) cboLabels.SelectedIndex = i + 2; } if (MapValues.mapPolyLabels == Values.EmptyGuid) cboLabels.SelectedIndex = 0; if (MapValues.mapPolyLabels == Values.FullGuid) cboLabels.SelectedIndex = 1; lstPolygons.CheckBoxes = true; } #if !(PocketPC || WindowsCE || Mobile) lstPolygons.Columns[0].Width = -2; lstPolygons.Columns[1].Width = -2; lstPolygons.Columns[2].Width = -2; #endif }
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; } }
public void Init(TtPoint p, int currentZone, DataAccessLayer dal) { 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; _init = true; this.currentZone = currentZone; pointName = p.PID; this.Text = "Point: " + pointName; pointCN = p.CN; DAL = dal; logged = 0; recieved = 0; logging = bLogBtn = _data = calculated = false; NmeaData = new List<NmeaBurst>(); if (dal.GetPointCount(p.PolyCN) < 1) { checkMeta = true; } }
public static bool CanAdjust(DataAccessLayer dal) { foreach (TtPolygon poly in dal.GetPolygons()) { if (dal.GetPointCount(poly.CN) > 0) { TtPoint p = dal.GetFirstPointInPolygon(poly.CN); if (p != null) { if (p.IsTravType()) { System.Windows.Forms.MessageBox.Show(String.Format("Polygon {0} can not start with a {1}. Point {2} must derive from a GPS type or Quondam.", poly.Name, p.op.ToString(), p.PID), "Bad Polygon Start"); return false; } /* else if (p.op == OpType.Quondam) { if (((QuondamPoint)p).ParentOp == OpType.Traverse) { System.Windows.Forms.MessageBox.Show(String.Format("Polygon {0} can not start with a Quondam to a Traverse. Point {2} must derive from a GPS type.", poly.Name, p.op.ToString(), p.PID), "Bad Polygon Start"); return false; } } */ } else { //no point return false; } } } return true; }