/// <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);
        }
Exemple #2
0
 // Checks if dimension has changed and if so adjusts the settings
 private void CheckDimension()
 {
     if (!dimension.Equals(oldDimension))
     {
         oldDimension = dimension;
         ApplyDimension();
     }
 }
        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));
        }
Exemple #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"));
        }
Exemple #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.");
        }
Exemple #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.");
        }
Exemple #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.");
        }
Exemple #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.");
        }
Exemple #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));
        }
Exemple #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));
 }
Exemple #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.");
        }
Exemple #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));
        }
Exemple #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"));
        }
Exemple #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)
                 ));
        }
Exemple #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));
        }
 /// <inheritdoc />
 public bool Equals(GeoCoordinate other)
 {
     return(Longitude.Equals(other.Longitude) && Latitude.Equals(other.Latitude) && Dimension.Equals(other.Dimension) && string.Equals(Globe, other.Globe));
 }
Exemple #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.");
        }