Ejemplo n.º 1
0
        /// <summary>
        /// Initializes a new instance of the <see cref="Extent"/> class that
        /// corresponds to a window (where the coverage is expressed using floating
        /// point values).
        /// </summary>
        /// <param name="extent">The covering rectangle (expressed using floating
        /// point values)</param>
        internal Extent(IWindow extent)
        {
            m_X = new RangeValue(Dimension.X,
                                 Length.ToMicrons(extent.Min.X),
                                 Length.ToMicrons(extent.Max.X));

            m_Y = new RangeValue(Dimension.Y,
                                 Length.ToMicrons(extent.Min.Y),
                                 Length.ToMicrons(extent.Max.Y));
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Checks whether a pair of ranges overlap
        /// </summary>
        /// <param name="that">The range to compare with this one</param>
        /// <returns>True if the ranges refer to the same positional dimension and they overlap or touch.
        /// False if they refer to different dimensions, or they don't overlap.
        /// </returns>
        internal bool IsOverlap(RangeValue that)
        {
            if (this.m_Dimension != that.m_Dimension)
            {
                return(false);
            }

            // The "range" may actually be a point
            if (that.m_Min == that.m_Max)
            {
                return(this.m_Min <= that.m_Min && that.m_Max <= this.m_Max);
            }

            return(Math.Max(this.m_Min, that.m_Min) <= Math.Min(this.m_Max, that.m_Max));
        }
Ejemplo n.º 3
0
 /// <summary>
 /// Initializes a new instance of the <see cref="Extent"/> class.
 /// </summary>
 /// <param name="minx">The western edge, in microns</param>
 /// <param name="miny">The southern edge, in microns</param>
 /// <param name="maxx">The eastern edge, in microns</param>
 /// <param name="maxy">The northern edge, in microns</param>
 internal Extent(ulong minx, ulong miny, ulong maxx, ulong maxy)
 {
     m_X = new RangeValue(Dimension.X, minx, maxx);
     m_Y = new RangeValue(Dimension.Y, miny, maxy);
 }
Ejemplo n.º 4
0
 /// <summary>
 /// Checks whether this window overlaps a positional range
 /// </summary>
 /// <param name="r">The range to examine</param>
 /// <returns>True if range overlaps this window.
 /// False if there's no overlap (or range only touches)</returns>
 internal bool IsOverlap(RangeValue r)
 {
     return(m_X.IsOverlap(r) || m_Y.IsOverlap(r));
 }
Ejemplo n.º 5
0
        /// <summary>
        /// Checks whether a pair of ranges overlap
        /// </summary>
        /// <param name="that">The range to compare with this one</param>
        /// <returns>True if the ranges refer to the same positional dimension and they overlap or touch.
        /// False if they refer to different dimensions, or they don't overlap.
        /// </returns>
        internal bool IsOverlap(RangeValue that)
        {
            if (this.m_Dimension!=that.m_Dimension)
                return false;

            // The "range" may actually be a point
            if (that.m_Min==that.m_Max)
                return (this.m_Min<=that.m_Min && that.m_Max<=this.m_Max);

            return (Math.Max(this.m_Min, that.m_Min) <= Math.Min(this.m_Max, that.m_Max));
        }