Пример #1
0
        public override void setUp()
        {
            base.setUp();
            JDFDoc doc = new JDFDoc("MatrixState");

            sState = (JDFMatrixState)doc.getRoot();
        }
Пример #2
0
        public virtual void testGetMatrixState()
        {
            JDFDoc         d  = new JDFDoc("DevCap");
            JDFDevCap      dc = (JDFDevCap)d.getRoot();
            JDFMatrixState ms = dc.appendMatrixState("foo");

            Assert.AreEqual("foo", ms.getName());
            ms = dc.getMatrixState("bar");
            Assert.IsNull(ms);
            ms = dc.getCreateMatrixState("bar");
            Assert.IsNotNull(ms);
            Assert.AreEqual("bar", ms.getName());
            ms = dc.getMatrixState("bar");
            Assert.IsNotNull(ms);
            Assert.AreEqual("bar", ms.getName());
        }
Пример #3
0
        public void testFitsValue_MatrixState()
        {
            JDFDoc  jdfDoc = new JDFDoc(ElementName.JDF);
            JDFNode root   = jdfDoc.getJDFRoot();

            JDFMatrix matrix1 = new JDFMatrix("1 0 0 1 3.14 21631.3");
            JDFMatrix matrix2 = new JDFMatrix("0 1 1 0 2 21000");

            List <ValuedEnum> transforms = new List <ValuedEnum>();

            transforms.Add(EnumOrientation.Rotate0);
            transforms.Add(EnumOrientation.Rotate270);
            transforms.Add(EnumOrientation.Flip0);
            JDFRectangle shift = new JDFRectangle("2 4 20000 23000");

            string value1 = "1 0 0 1 3.14 21631.3";

            JDFMatrixState k = (JDFMatrixState)root.appendElement("MatrixState");

            k.appendValue();
            // k.setValueValueUsage(0, EnumFitsValue.Allowed);
            k.setValueAllowedValue(0, matrix2);

            k.appendValue();
            // k.setValueValueUsage(1, EnumFitsValue.Present);
            k.setValueAllowedValue(1, matrix1);

            k.setAllowedTransforms(transforms);
            k.setAllowedShift(shift);
            k.setAllowedRotateMod(15);

            EnumListType lt = EnumListType.UniqueList;

            // JDFAbstractState.EnumListType lt = EnumListType.ListType.Unknown;
            // JDFAbstractState.EnumListType lt = EnumListType.ListType.List;
            k.setListType(lt);
            // EnumListType listType = k.getListType();

            Assert.IsTrue(k.fitsValue(value1, EnumFitsValue.Allowed), "Matrix OK");

            string @value = "1 2 3 4 5 6 7 8 9 10 11 12 3 4 5 6 7 8";

            VString vs  = new VString(@value, JDFConstants.BLANK);
            int     siz = vs.Count;

            Assert.AreEqual(0, siz % 6, "It is not a Matrix");
            VString       matrixList = new VString();
            int           i          = 0;
            StringBuilder sb         = new StringBuilder(250);

            sb.Append(vs[i]);
            while ((i + 1) < siz)
            {
                do
                {
                    sb.Append(JDFConstants.BLANK);
                    i++;
                    sb.Append(vs[i]);
                } while ((i + 1) % 6 != 0);
                matrixList.Add(sb.ToString());
                if ((i + 1) < siz)
                {
                    i++;
                    sb = new StringBuilder(250);
                    sb.Append(vs[i]);
                }
            }
            for (int z = 0; z < matrixList.Count; z++)
            {
                JDFMatrix matrix3 = new JDFMatrix(matrixList.stringAt(z));
                //matrix3.A;
            }
        }