Esempio n. 1
0
 /**
  * Move a rectangle
  *
  * @param deltaX            The delta x-location by which the rectangle should be moved -- must be a valid double
  * @param deltaY            The delta y-location by which the rectangle should be moved -- must be a valid double
  * @throws ShapeException   Exception throw if any parameter is invalid
  * @throws ShapeException   When a rectangle is moved to have a length of zero
  */
 public void Move(double deltaX, double deltaY)
 {
     Line1.Move(deltaX, deltaY);
     Line2.Move(deltaX, deltaY);
     Line3.Move(deltaX, deltaY);
     Line4.Move(deltaX, deltaY);
 }
Esempio n. 2
0
        /*
         * ValidateSquare ensures that all vertecies have an angle of 90
         */
        public void ValidateSquare()
        {
            var LineAC = new Line(Line1.Point1, Line2.Point2);

            if (
                (Math.Acos((Math.Pow(Line1.ComputeLength(), 2) + Math.Pow(Line4.ComputeLength(), 2) - Math.Pow(LineAC.ComputeLength(), 2) / (2 * Line1.ComputeLength() * Line4.ComputeLength())))) != 90
                )
            {
                throw new ShapeException("Invalid rectangle");
            }
        }
        public override int GetHashCode()
        {
            unchecked
            {
                int hashCode = Line1 != null?Line1.GetHashCode() : 0;

                hashCode = (hashCode * 397) ^ (Line2 != null ? Line2.GetHashCode() : 0);
                hashCode = (hashCode * 397) ^ (Line3 != null ? Line3.GetHashCode() : 0);
                hashCode = (hashCode * 397) ^ (Line4 != null ? Line4.GetHashCode() : 0);
                hashCode = (hashCode * 397) ^ (City != null ? City.GetHashCode() : 0);
                hashCode = (hashCode * 397) ^ (State != null ? State.GetHashCode() : 0);
                hashCode = (hashCode * 397) ^ (PostalCode != null ? PostalCode.GetHashCode() : 0);
                hashCode = (hashCode * 397) ^ (Country != null ? Country.GetHashCode() : 0);
                return(hashCode);
            }
        }
 /// <summary>
 /// Called on each bar update event (incoming tick)
 /// </summary>
 protected override void OnBarUpdate()
 {
     if (Line1Value != 0)
     {
         Line1.Set(Line1Value);
     }
     if (Line2Value != 0)
     {
         Line2.Set(Line2Value);
     }
     if (Line3Value != 0)
     {
         Line3.Set(Line3Value);
     }
     if (Line4Value != 0)
     {
         Line4.Set(Line4Value);
     }
 }