Пример #1
0
        /// <summary>
        /// Gets the image resolution in pixels.
        /// </summary>
        /// <param name="dim"></param>
        /// <returns></returns>
        private int GetPixelDimension(Dimension dim)
        {
            int pixelCount = 0;

            try
            {
                PropertyItem dimensionPixelCount = null;
                if (dim.Equals(Dimension.X))
                {
                    dimensionPixelCount = GetImageProperty(Constants.PixelXDimension);
                }
                else if (dim.Equals(Dimension.Y))
                {
                    dimensionPixelCount = GetImageProperty(Constants.PixelYDimension);
                }
                if (dimensionPixelCount != null)
                {
                    double pixelCountValue = 0.00;
                    for (int count = 0; count < dimensionPixelCount.Value.Length; count++)
                    {
                        pixelCountValue += dimensionPixelCount.Value[count] * Math.Pow(256, count);
                    }
                    pixelCount = Convert.ToInt32(pixelCountValue);
                }
            }
            catch (Exception)
            {
                pixelCount = -1;
            }
            return(pixelCount);
        }
Пример #2
0
 // Checks if dimension has changed and if so adjusts the settings
 private void CheckDimension()
 {
     if (!dimension.Equals(oldDimension))
     {
         oldDimension = dimension;
         ApplyDimension();
     }
 }
Пример #3
0
        public void EqualsTest()
        {
            Dimension dimensionA;
            Dimension dimensionB;

            dimensionA = new Dimension(1, 2, 3, 4, 5, 6, 7, 8);
            dimensionB = new Dimension(1, 2, 3, 4, 5, 6, 7, 8);
            Assert.IsTrue(dimensionA.Equals(dimensionB));
            dimensionB = new Dimension(0, 2, 3, 4, 5, 6, 7, 8);
            Assert.IsFalse(dimensionA.Equals(dimensionB));
            dimensionB = new Dimension(1, 0, 3, 4, 5, 6, 7, 8);
            Assert.IsFalse(dimensionA.Equals(dimensionB));
            dimensionB = new Dimension(1, 2, 0, 4, 5, 6, 7, 8);
            Assert.IsFalse(dimensionA.Equals(dimensionB));
            dimensionB = new Dimension(1, 2, 3, 0, 5, 6, 7, 8);
            Assert.IsFalse(dimensionA.Equals(dimensionB));
            dimensionB = new Dimension(1, 2, 3, 4, 0, 6, 7, 8);
            Assert.IsFalse(dimensionA.Equals(dimensionB));
            dimensionB = new Dimension(1, 2, 3, 4, 5, 0, 7, 8);
            Assert.IsFalse(dimensionA.Equals(dimensionB));
            dimensionB = new Dimension(1, 2, 3, 4, 5, 6, 0, 8);
            Assert.IsFalse(dimensionA.Equals(dimensionB));
            dimensionB = new Dimension(1, 2, 3, 4, 5, 6, 7, 0);
            Assert.IsFalse(dimensionA.Equals(dimensionB));
        }
Пример #4
0
        public void Equals()
        {
            Dimension dimension = new Dimension();

            dimension.SetPower(DimensionBase.Length, 3);
            dimension.SetPower(DimensionBase.Time, -1);

            Assert.IsTrue(dimension.Equals(this.dimension));
            dimension.SetPower(DimensionBase.Length, 2);
            Assert.IsFalse(dimension.Equals(this.dimension));

            Assert.IsFalse(dimension.Equals("string"));
        }
Пример #5
0
        public void Equals_Tuple_Null()
        {
            var a = new Dimension(1, 2);
            var b = (Tuple <int, int>)null;

            Assert.IsFalse(a.Equals(b), "Incorrect result from Equals(...) method.");
        }
Пример #6
0
        public void Equals_Object_Dimension_OK()
        {
            var a = new Dimension(1, 2);
            var b = new Dimension(1, 2);

            Assert.IsTrue(a.Equals((object)b), "Incorrect result from Equals(...) method.");
        }
Пример #7
0
        public void Equals_Dimension_NotEqual()
        {
            var a = new Dimension(1, 2);
            var b = new Dimension(3, 4);

            Assert.IsFalse(a.Equals(b), "Incorrect result from Equals(...) method.");
        }
Пример #8
0
        public void Equals_Tuple_OK()
        {
            var a = new Dimension(1, 2);
            var b = new Tuple <int, int>(1, 2);

            Assert.IsTrue(a.Equals(b), "Incorrect result from Equals(...) method.");
        }
Пример #9
0
        public void TestEquals()
        {
            var test00 = new Dimension(0.31D, 0.125D);
            var test01 = new Dimension(0.31D, 0.125D);

            Assert.IsTrue(test00.Equals(test01));
        }
Пример #10
0
 public bool Equals([AllowNull] PathBounds other)
 {
     return(m_minimumX.Equals(other.m_minimumX) &&
            m_maximumX.Equals(other.m_maximumX) &&
            m_minimumY.Equals(other.m_minimumY) &&
            m_maximumY.Equals(other.m_maximumY));
 }
Пример #11
0
        public void Equals_Object_Tuple_NotEqual()
        {
            var a = new Dimension(1, 2);
            var b = new Tuple <int, int>(3, 4);

            Assert.IsFalse(a.Equals((object)b), "Incorrect result from Equals(...) method.");
        }
Пример #12
0
        public void DimensionConstructorTest2()
        {
            Dimension dimensionA = new Dimension(1, 2, 3, 4, 5, 6, 7, 8);
            Dimension dimensionB = new Dimension(dimensionA);

            Assert.IsTrue(dimensionA.Equals(dimensionB));
        }
Пример #13
0
        public void Equals()
        {
            Dimension dimension = new Dimension();

            dimension.SetPower(DimensionBase.Length, 3);
            dimension.SetPower(DimensionBase.Time, -1);

            Dimension dimension2 = new Dimension();

            dimension2.SetPower(DimensionBase.Length, 3);
            dimension2.SetPower(DimensionBase.Time, -1);

            Assert.IsTrue(Dimension.DescribesSameAs(dimension, dimension2));
            dimension.SetPower(DimensionBase.Length, 2);
            Assert.IsFalse(Dimension.DescribesSameAs(dimension, dimension2));

            Assert.IsFalse(dimension.Equals("string"));
        }
Пример #14
0
        /// <summary>
        /// Returns true if Product instances are equal
        /// </summary>
        /// <param name="other">Instance of Product to be compared</param>
        /// <returns>Boolean</returns>
        public bool Equals(Product other)
        {
            if (ReferenceEquals(null, other))
            {
                return(false);
            }
            if (ReferenceEquals(this, other))
            {
                return(true);
            }

            return
                ((
                     ID == other.ID ||
                     ID != null &&
                     ID.Equals(other.ID)
                     ) &&
                 (
                     Code == other.Code ||
                     Code != null &&
                     Code.Equals(other.Code)
                 ) &&
                 (
                     Name == other.Name ||
                     Name != null &&
                     Name.Equals(other.Name)
                 ) &&
                 (
                     Description == other.Description ||
                     Description != null &&
                     Description.Equals(other.Description)
                 ) &&
                 (
                     Dimension == other.Dimension ||
                     Dimension != null &&
                     Dimension.Equals(other.Dimension)
                 ) &&
                 (
                     VendorID == other.VendorID ||
                     VendorID != null &&
                     VendorID.Equals(other.VendorID)
                 ));
        }
Пример #15
0
        public bool Equals(CLFFTSettings other)
        {
            if (ReferenceEquals(null, other))
            {
                return(false);
            }
            if (ReferenceEquals(this, other))
            {
                return(true);
            }

            return(ResultLocation.Equals(other.ResultLocation) &&
                   Dimension.Equals(other.Dimension) &&
                   Layout.Equals(other.Layout) &&
                   Size.SequenceEqual(other.Size) &&
                   StrideIn.SequenceEqual(other.StrideIn) &&
                   StrideOut.SequenceEqual(other.StrideOut) &&
                   BatchSize.Equals(other.BatchSize) &&
                   PlanDistanceIn.Equals(other.PlanDistanceIn) &&
                   PlanDistanceOut.Equals(other.PlanDistanceOut) &&
                   ScaleForward.Equals(other.ScaleForward) &&
                   ScaleBackward.Equals(other.ScaleBackward));
        }
Пример #16
0
 /// <inheritdoc />
 public bool Equals(GeoCoordinate other)
 {
     return(Longitude.Equals(other.Longitude) && Latitude.Equals(other.Latitude) && Dimension.Equals(other.Dimension) && string.Equals(Globe, other.Globe));
 }
Пример #17
0
        public void Equals_Object_Other_Null()
        {
            var a = new Dimension(1, 2);

            Assert.IsFalse(a.Equals((object)null), "Incorrect result from Equals(...) method.");
        }