private void changePntBtn_Click(object sender, EventArgs e) { if (waypointsLbx.SelectedItem != null) { RNGeoPoint2D pnt = new RNGeoPoint2D(latDeg + latMin / 60.0 + latSec / 3600.0, lonDeg + lonMin / 60.0 + lonSec / 3600.0, 2); waypointsLbx.Items[waypointsLbx.SelectedIndex] = pnt; } }
private void port_WaypointReceived(object sender, WaypointEventArgs e) { RNGeoPoint2D pnt = new RNGeoPoint2D(e.Latitude, e.Longitude, e.WaypointType); if (!((e.Latitude == 0.0) && (e.Longitude == 0.0))) { InvokeAddListBoxItem(waypointsLbx, pnt); waypoints.Add(pnt); } if (e.WaypointIdx == waypointsCount - 1) { InvokeSetEnabledState(syncWaypointsBtn, true); InvokeSetButtonsVisibleState(true); } }
private void waypointsLbx_SelectedIndexChanged(object sender, EventArgs e) { if (waypointsLbx.SelectedItem != null) { RNGeoPoint2D pnt = (RNGeoPoint2D)waypointsLbx.SelectedItem; if (pnt.PType == 2) { latDeg = (int)Math.Floor(pnt.Latitude); latMin = (int)Math.Round((pnt.Latitude - latDeg) * 60.0); double tmp = (pnt.Latitude - latDeg) * 3600.0 - latMin * 60.0; if (tmp < 0) { tmp = 0; } latSec = tmp; lonDeg = (int)Math.Floor(pnt.Longitude); lonMin = (int)Math.Round((pnt.Longitude - lonDeg) * 60.0); tmp = (pnt.Longitude - lonDeg) * 3600.0 - lonMin * 60.0; if (tmp < 0) { tmp = 0; } lonSec = tmp; latGroup.Visible = true; lonGroup.Visible = true; changePntBtn.Visible = true; } else { latGroup.Visible = false; lonGroup.Visible = false; changePntBtn.Visible = false; } } else { latGroup.Visible = false; lonGroup.Visible = false; changePntBtn.Visible = false; } }