Beispiel #1
0
 ///
 ///	 <summary> * shift this matrix by an xypair
 ///	 *  </summary>
 ///	 * <param name="point"> the point to shift by </param>
 ///
 public virtual void shift(JDFXYPair point)
 {
     if (point == null)
     {
         return;
     }
     shift(point.X, point.Y);
 }
Beispiel #2
0
        public void testClone()
        {
            JDFXYPair ab = new JDFXYPair(1.0, 2.0);
            JDFXYPair ac = new JDFXYPair(ab);

            ac.X = 3.0;
            Assert.AreEqual(1.0, ab.X, 0.0);
        }
Beispiel #3
0
        public void testIsLessOrEqual()
        {
            JDFXYPair xy = new JDFXYPair();

            JDFXYPair ab = new JDFXYPair(1.0, 2.0);

            xy = new JDFXYPair(1.0 - JDFBaseDataTypes_Fields.EPSILON / 2.0, 2.0 - JDFBaseDataTypes_Fields.EPSILON / 2.0);

            Assert.IsTrue(ab.Equals(xy));
            Assert.IsTrue(ab.isLessOrEqual(xy));
            Assert.IsTrue(ab.isGreaterOrEqual(xy));
        }
Beispiel #4
0
        ///
        ///	 <summary> * equals - returns true if both JDFShapes are equal, otherwise false
        ///	 *  </summary>
        ///	 * <returns> boolean - true if equal otherwise false </returns>
        ///
        public override bool Equals(object other)
        {
            if (this == other)
            {
                return(true);
            }
            if (other == null)
            {
                return(false);
            }
            if (!other.GetType().Equals(this.GetType()))
            {
                return(false);
            }

            JDFXYPair xyPair = (JDFXYPair)other;

            return((Math.Abs(this.X - xyPair.X) <= JDFBaseDataTypes_Fields.EPSILON) && (Math.Abs(this.Y - xyPair.Y) <= JDFBaseDataTypes_Fields.EPSILON));
        }
Beispiel #5
0
        public void testSetString()
        {
            JDFDoc  doc = new JDFDoc("JDF");
            JDFNode n   = doc.getJDFRoot();

            JDFXYPair xy = new JDFXYPair("1 2");

            n.setAttribute("test", xy, null);

            xy = new JDFXYPair("1.1 2.2");
            n.setAttribute("test2", xy, null);
            Assert.AreEqual("1.1 2.2", n.getAttribute("test2", null, ""), "double double");

            try
            {
                new JDFXYPair("1 2 3");
            }
            catch (FormatException)
            {
                Assert.IsTrue(true, "exception 123 caught");
            }
        }
Beispiel #6
0
 ///
 ///	 <summary> * isLess - equality operator <
 ///	 *  </summary>
 ///	 * <param name="x"> the JDFXYPair object to compare to </param>
 ///	 * <returns> boolean - true if this < x </returns>
 ///
 public virtual bool isLess(JDFXYPair x)
 {
     return(!isGreaterOrEqual(x));
 }
Beispiel #7
0
 ///
 ///	 <summary> * isLessOrEqual - equality operator <=
 ///	 *  </summary>
 ///	 * <param name="x"> the JDFXYPair object to compare to </param>
 ///	 * <returns> boolean - true if this <= x </returns>
 ///
 public virtual bool isLessOrEqual(JDFXYPair x)
 {
     return(Equals(x) || ((this.X <= x.X) && (this.Y <= x.Y)));
 }
Beispiel #8
0
 ///
 ///	 <summary> * isGreaterOrEqual - equality operator >=
 ///	 *  </summary>
 ///	 * <param name="x"> the JDFXYPair object to compare to </param>
 ///	 * <returns> boolean - true if this >= x </returns>
 ///
 public virtual bool isGreaterOrEqual(JDFXYPair x)
 {
     return(Equals(x) || ((this.X >= x.X) && (this.Y >= x.Y)));
 }
Beispiel #9
0
 ///
 ///	 <summary> * constructs a xy pair with all values set via a JDFXYPair
 ///	 *  </summary>
 ///	 * <param name="xy"> the given xy pair
 ///	 *  </param>
 ///
 public JDFXYPair(JDFXYPair xy)
     : base(JDFBaseDataTypes_Fields.MAX_XY_DIMENSION)
 {
     this.X = xy.X;
     this.Y = xy.Y;
 }
Beispiel #10
0
 ///
 ///	 <summary> * add - adds a xy coordinate to the vector
 ///	 *  </summary>
 ///	 * <param name="xy"> the xy coordinate to add </param>
 ///
 public virtual void Add(JDFXYPair xy)
 {
     m_numList.Add(xy.X); // (new double(xy.getX()));
     m_numList.Add(xy.Y); // (new double(xy.getY()));
 }