private void AddAlignmentPoint(double[] mountAltAz, double[] observedAltAz, AxisPosition mountAxes, AxisPosition observedAxes, PierSide pierSide, DateTime syncTime) { lock (_accessLock) { if (AlignmentPoints.Count > 2 && ProximityLimit > 0.0) { // Remove any existing alignment points that are too close to the new one. var nearPoints = AlignmentPoints .Where(p => p.MountAxes.IncludedAngleTo(mountAxes) <= ProximityLimit).ToList(); foreach (AlignmentPoint deletePt in nearPoints) { AlignmentPoints.Remove(deletePt); } } CarteseanCoordinate mountXy = AltAzToCartesean(mountAltAz); CarteseanCoordinate observedXy = AltAzToCartesean(observedAltAz); AlignmentPoints.Add(new AlignmentPoint(observedAltAz, mountAxes, observedAxes, mountXy, observedXy, pierSide, syncTime)); _currentChecksum = int.MinValue; // Reset checksum so that offsets are recalculated OneStarAdjustment[0] = observedAxes[0] - mountAxes[0]; OneStarAdjustment[1] = observedAxes[1] - mountAxes[1]; SaveAlignmentPoints(); } }
public bool RemoveAlignmentPoint(AlignmentPoint pointToDelete) { try { bool result = AlignmentPoints.Remove(pointToDelete); if (result) { SaveAlignmentPoints(); } return(result); } catch (Exception ex) { LogException(ex, true); return(false); } }