示例#1
0
        public virtual void testShiftXY()
        {
            JDFMatrix m = new JDFMatrix(EnumOrientation.Rotate90, 0, 0);

            m.shift(new JDFXYPair(20, 25));
            Assert.AreEqual(new JDFMatrix("0 1 -1 0 20 25"), m);
        }
示例#2
0
        public virtual void testCreate()
        {
            JDFMatrix m  = new JDFMatrix(90, 20, 20);
            JDFMatrix m2 = new JDFMatrix(EnumOrientation.Rotate90, 0, 0);

            m2.shift(20, 20);
            Assert.AreEqual(m, m2);
        }
示例#3
0
        public virtual void testClone()
        {
            JDFMatrix m = (JDFMatrix)JDFMatrix.unitMatrix.Clone();

            m.rotate(180);
            Assert.AreNotEqual(JDFMatrix.unitMatrix, m);
            Assert.AreEqual(JDFMatrix.unitMatrix, new JDFMatrix("1 0 0 1 0 0"));
            Assert.AreEqual(new JDFMatrix(EnumOrientation.Rotate180, 0, 0), m);
        }
示例#4
0
        ///
        ///	 <summary> * concatinates this with m
        ///	 *  </summary>
        ///	 * <param name="m"> the matrix to concatinate </param>
        ///	 * <param name="tY"> shift in y direction </param>
        ///
        public virtual void concat(JDFMatrix m)
        {
            Matrix a  = AffineTransform;
            Matrix ma = m.AffineTransform;

            //UPGRADE_TODO: Method 'java.awt.geom.AffineTransform.concatenate' was converted to 'System.Drawing.Drawing2D.Matrix.Multiply' which has a different behavior. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1073_javaawtgeomAffineTransformconcatenate_javaawtgeomAffineTransform'"
            a.Multiply(ma, MatrixOrder.Append);
            AffineTransform = a;
        }
示例#5
0
        public virtual void testShift()
        {
            JDFMatrix m = new JDFMatrix(EnumOrientation.Rotate0, 0, 0);

            Assert.AreEqual(JDFMatrix.unitMatrix, m);
            m.shift(10, 11);
            Assert.AreEqual(new JDFMatrix("1 0 0 1 10 11"), m);
            m.shift(10, 11);
            Assert.AreEqual(new JDFMatrix("1 0 0 1 20 22"), m, "2nd shift adds up");
        }
示例#6
0
 ///
 ///	 <summary> * constructs a matrix with all values set via a JDFMatrix
 ///	 *  </summary>
 ///	 * <param name="JDma"> the given matrix </param>
 ///
 public JDFMatrix(JDFMatrix ma)
     : base(JDFBaseDataTypes_Fields.MAX_MATRIX_DIMENSION)
 {
     A  = ma.A;
     B  = ma.B;
     C  = ma.C;
     D  = ma.D;
     Tx = ma.Tx;
     Ty = ma.Ty;
 }
示例#7
0
        public virtual void testSetString()
        {
            JDFDoc  d = new JDFDoc("JDF");
            JDFNode n = d.getJDFRoot();

            JDFMatrix m = new JDFMatrix("1 0 0 1 0 0");

            Assert.AreEqual(JDFMatrix.unitMatrix, m);
            n.setAttribute("foo", m, null);
            Assert.AreEqual(n.getAttribute("foo"), m.ToString());
        }
示例#8
0
        public virtual void testConcat()
        {
            JDFMatrix m  = new JDFMatrix(EnumOrientation.Rotate90, 0, 0);
            JDFMatrix m2 = new JDFMatrix(EnumOrientation.Rotate270, 0, 0);

            m.concat(m2);
            Assert.AreEqual(JDFMatrix.unitMatrix, m);

            m = new JDFMatrix(EnumOrientation.Rotate90, 0, 0);
            m.concat(m);
            Assert.AreEqual(new JDFMatrix(EnumOrientation.Rotate180, 0, 0), m);

            m = new JDFMatrix(EnumOrientation.Flip180, 0, 0);
            m.concat(m);
            Assert.AreEqual(new JDFMatrix(EnumOrientation.Rotate0, 0, 0), m);
        }
示例#9
0
        public virtual void testRotate()
        {
            JDFMatrix m = new JDFMatrix(EnumOrientation.Rotate0, 0, 0);

            Assert.AreEqual(JDFMatrix.unitMatrix, m);
            m.rotate(180);
            Assert.AreEqual(new JDFMatrix(EnumOrientation.Rotate180, 0, 0), m);
            m.rotate(90);
            Assert.AreEqual(new JDFMatrix(EnumOrientation.Rotate270, 0, 0), m);

            m.rotate(180);
            Assert.AreEqual(new JDFMatrix(EnumOrientation.Rotate90, 0, 0), m);
            m = new JDFMatrix(EnumOrientation.Flip0, 0, 0);
            m.rotate(180);
            Assert.AreEqual(new JDFMatrix(EnumOrientation.Flip180, 0, 0), m);
            m.rotate(90);
            Assert.AreEqual(new JDFMatrix(EnumOrientation.Flip270, 0, 0), m);
        }
示例#10
0
        ///
        ///	 <summary> * equals - returns true if both JDFMatrices 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);
            }

            JDFMatrix m = (JDFMatrix)other;

            return((Math.Abs(this.A - m.A) <= JDFBaseDataTypes_Fields.EPSILON) && (Math.Abs(this.B - m.B) <= JDFBaseDataTypes_Fields.EPSILON) && (Math.Abs(this.C - m.C) <= JDFBaseDataTypes_Fields.EPSILON) && (Math.Abs(this.D - m.D) <= JDFBaseDataTypes_Fields.EPSILON) && (Math.Abs(this.Tx - m.Tx) <= JDFBaseDataTypes_Fields.EPSILON) && (Math.Abs(this.Ty - m.Ty) <= JDFBaseDataTypes_Fields.EPSILON));
        }
示例#11
0
        public virtual void testOrientation()
        {
            JDFMatrix m = new JDFMatrix(EnumOrientation.Rotate0, 0, 0);

            Assert.AreEqual(JDFMatrix.unitMatrix, m);
        }