/// <summary> /// Returns the hash code for this instance. /// </summary> /// <returns> /// A 32-bit signed integer that is the hash code for this instance. /// </returns> public override int GetHashCode() { unchecked { int hashCode = Size.GetHashCode(); hashCode = (hashCode * 397) ^ (int)Mode; hashCode = (hashCode * 397) ^ (int)Position; hashCode = (hashCode * 397) ^ (CenterCoordinates?.GetHashCode() ?? 0); hashCode = (hashCode * 397) ^ (int)Resampling; hashCode = (hashCode * 397) ^ Compand.GetHashCode(); return((hashCode * 397) ^ (hashCode * 397) ^ (TargetRectangle?.GetHashCode() ?? 0)); } }
/// <summary> /// Returns the hash code for this instance. /// </summary> /// <returns> /// A 32-bit signed integer that is the hash code for this instance. /// </returns> public override int GetHashCode() { unchecked { var hashCode = Size.GetHashCode(); hashCode = (hashCode * 397) ^ MaxSize.GetHashCode(); hashCode = (hashCode * 397) ^ (RestrictedSizes?.GetHashCode() ?? 0); hashCode = (hashCode * 397) ^ (int)ResizeMode; hashCode = (hashCode * 397) ^ (int)AnchorPosition; hashCode = (hashCode * 397) ^ Upscale.GetHashCode(); hashCode = (hashCode * 397) ^ (CenterCoordinates?.GetHashCode() ?? 0); hashCode = (hashCode * 397) ^ AnchorPoint.GetHashCode(); return(hashCode); } }
/// <summary> /// Returns a value that indicates whether the specified object is an /// <see cref="ResizeLayer"/> object that is equivalent to /// this <see cref="ResizeLayer"/> object. /// </summary> /// <param name="obj"> /// The object to test. /// </param> /// <returns> /// True if the given object is an <see cref="ResizeLayer"/> object that is equivalent to /// this <see cref="ResizeLayer"/> object; otherwise, false. /// </returns> public override bool Equals(object obj) { var resizeLayer = obj as ResizeLayer; if (resizeLayer == null) { return(false); } return(Size == resizeLayer.Size && ResizeMode == resizeLayer.ResizeMode && AnchorPosition == resizeLayer.AnchorPosition && Upscale == resizeLayer.Upscale && ((CenterCoordinates != null && resizeLayer.CenterCoordinates != null && CenterCoordinates.SequenceEqual(resizeLayer.CenterCoordinates)) || (CenterCoordinates == resizeLayer.CenterCoordinates)) && MaxSize == resizeLayer.MaxSize && ((RestrictedSizes != null && resizeLayer.RestrictedSizes != null && RestrictedSizes.SequenceEqual(resizeLayer.RestrictedSizes)) || (RestrictedSizes == resizeLayer.RestrictedSizes)) && AnchorPoint == resizeLayer.AnchorPoint); }
public void Shift(Vector delta) { if (delta.X == 0 && delta.Y == 0 && AbsoluteCenterCoordinates != null) { return; } CenterCoordinates = CenterCoordinates.Shift(delta.X, delta.Y, Rotation, ArcSecWidth, ArcSecHeight); AbsoluteCenterCoordinates = new Coordinates(CenterCoordinates.RADegrees, Math.Abs(CenterCoordinates.Dec), Epoch.J2000, Coordinates.RAType.Degrees); TopCenter = AbsoluteCenterCoordinates.Shift(0, -OriginalVFoV / 2, 0); TopLeft = AbsoluteCenterCoordinates.Shift(-OriginalHFoV / 2, (-OriginalVFoV / 2), 0); BottomLeft = AbsoluteCenterCoordinates.Shift(-OriginalHFoV / 2, (OriginalVFoV / 2), 0); BottomCenter = AbsoluteCenterCoordinates.Shift(0, OriginalVFoV / 2, 0); VFoVDegTop = Math.Abs(Math.Max(TopCenter.Dec, TopLeft.Dec) - AbsoluteCenterCoordinates.Dec); VFoVDegBottom = Math.Abs(AbsoluteCenterCoordinates.Dec - Math.Min(BottomLeft.Dec, BottomCenter.Dec)); HFoVDeg = TopLeft.RADegrees > TopCenter.RADegrees ? TopLeft.RADegrees - TopCenter.RADegrees : TopLeft.RADegrees - TopCenter.RADegrees + 360; HFoVDeg *= 2; // if we're below 0 we need to flip all calculated decs if (CenterCoordinates.Dec < 0) { BottomLeft.Dec *= -1; TopLeft.Dec *= -1; TopCenter.Dec *= -1; BottomCenter.Dec *= -1; AboveZero = false; } else { AboveZero = true; } // if the top center ra is different than the center coordinate ra then the top center point is above 90deg if (Math.Abs(TopCenter.RADegrees - CenterCoordinates.RADegrees) > 0.0001) { // horizontal fov becomes 360 here and vertical fov the difference between center and 90deg HFoVDeg = 360; VFoVDegTop = 90 - AbsoluteCenterCoordinates.Dec; IsAbove90 = true; } else { IsAbove90 = false; } AbsCalcTopDec = AbsoluteCenterCoordinates.Dec + VFoVDegTop; AbsCalcBottomDec = AbsoluteCenterCoordinates.Dec - VFoVDegBottom; if (AboveZero) { CalcTopDec = CenterCoordinates.Dec + VFoVDegTop; CalcBottomDec = CenterCoordinates.Dec - VFoVDegBottom; } else { CalcTopDec = CenterCoordinates.Dec - VFoVDegTop; CalcBottomDec = CenterCoordinates.Dec + VFoVDegBottom; } CalcRAMax = TopLeft.RADegrees; CalcRAMin = CalcRAMax - HFoVDeg; if (CalcRAMin < 0) { CalcRAMin += 360; } }