예제 #1
0
        /// <summary>
        /// Checks to see if the element is in this region.
        /// The region is closed on the minimum x and y edges but open on the max x and y edges.
        /// </summary>
        /// <param name="element"></param>
        /// <returns></returns>
        public bool contains(HasPosition element)
        {
            float positionX = element.GetPositionX();
            float positionY = element.GetPositionY();

            return(x <= positionX && positionX < x + width && y <= positionY && positionY < y + height);
        }
예제 #2
0
        float HasPosition.DistanceTo(HasPosition otherElement)
        {
            float otherPositionX = otherElement.GetPositionX();
            float otherPositionY = otherElement.GetPositionY();

            return(Mathf.Sqrt(Mathf.Pow(x - otherPositionX, 2f) + Mathf.Pow(y - otherPositionY, 2f)));
        }
예제 #3
0
 public override int GetHashCode()
 {
     unchecked {
         var hashCode = HasName.GetHashCode();
         hashCode = (hashCode * 397) ^ HasTag.GetHashCode();
         hashCode = (hashCode * 397) ^ HasId.GetHashCode();
         hashCode = (hashCode * 397) ^ HasHelpContextId.GetHashCode();
         hashCode = (hashCode * 397) ^ HasBitFlags.GetHashCode();
         hashCode = (hashCode * 397) ^ HasObjectStreamSize.GetHashCode();
         hashCode = (hashCode * 397) ^ HasTabIndex.GetHashCode();
         hashCode = (hashCode * 397) ^ HasClsidCacheIndex.GetHashCode();
         hashCode = (hashCode * 397) ^ HasPosition.GetHashCode();
         hashCode = (hashCode * 397) ^ HasGroupId.GetHashCode();
         hashCode = (hashCode * 397) ^ HasControlTipText.GetHashCode();
         hashCode = (hashCode * 397) ^ HasRuntimeLicKey.GetHashCode();
         hashCode = (hashCode * 397) ^ HasControlSource.GetHashCode();
         hashCode = (hashCode * 397) ^ HasRowSource.GetHashCode();
         return(hashCode);
     }
 }
예제 #4
0
 /// <summary>
 /// Returns the minimum distance from the element to this region.
 /// </summary>
 /// <param name="element"></param>
 /// <returns></returns>
 public float distanceTo(HasPosition element)
 {
     return(distanceTo(element.GetPositionX(), element.GetPositionY()));
 }