コード例 #1
0
ファイル: JDFRefElementTest.cs プロジェクト: cip4/JDFLibNet
        public virtual void testInlineRefelement()
        {
            JDFDoc          d     = JDFTestCaseBase.creatXMDoc();
            JDFNode         n     = d.getJDFRoot();
            JDFExposedMedia xm    = (JDFExposedMedia)n.getMatchingResource("ExposedMedia", JDFNode.EnumProcessUsage.AnyInput, null, 0);
            JDFAttributeMap mPart = new JDFAttributeMap("SignatureName", "Sig1");

            mPart.put("SignatureName", "S12234");
            mPart.put("SheetName", "S12");
            mPart.put("Side", "Front");
            JDFExposedMedia xmPart = (JDFExposedMedia)xm.getCreatePartition(mPart, null);
            JDFMedia        m      = xm.getMedia();

            m = (JDFMedia)m.makeRootResource(null, null, true);
            m.setGrainDirection(EnumGrainDirection.XDirection);
            xmPart.refElement(m);
            Assert.AreEqual(xmPart.getMedia(), m);
            mPart.put("Side", "Back");
            xmPart = (JDFExposedMedia)xm.getCreatePartition(mPart, null);
            JDFMedia medPart = (JDFMedia)m.getCreatePartition(mPart, xm.getPartIDKeys());

            xmPart.refElement(medPart);
            Assert.AreEqual(xmPart.getMedia(), medPart);
            JDFRefElement re          = (JDFRefElement)xmPart.getElement("MediaRef");
            JDFMedia      inlineMedia = (JDFMedia)re.inlineRef();

            Assert.IsNull(xmPart.getElement_KElement("MediaRef", null, 0));
            Assert.AreEqual(EnumGrainDirection.XDirection, inlineMedia.getGrainDirection());
            Assert.AreEqual(xmPart.getMedia(), inlineMedia);
            Assert.IsFalse(inlineMedia.hasAttribute("ID"));
        }
コード例 #2
0
ファイル: JDFRefElementTest.cs プロジェクト: cip4/JDFLibNet
        public virtual void testGetTarget()
        {
            JDFDoc          d     = JDFTestCaseBase.creatXMDoc();
            JDFNode         n     = d.getJDFRoot();
            JDFExposedMedia xm    = (JDFExposedMedia)n.getMatchingResource("ExposedMedia", JDFNode.EnumProcessUsage.AnyInput, null, 0);
            JDFAttributeMap mPart = new JDFAttributeMap("SignatureName", "Sig1");

            mPart.put("SignatureName", "S12234");
            mPart.put("SheetName", "S12");
            mPart.put("Side", "Front");
            JDFExposedMedia xmPart = (JDFExposedMedia)xm.getCreatePartition(mPart, null);
            JDFMedia        m      = xm.getMedia();

            m = (JDFMedia)m.makeRootResource(null, null, true);
            xmPart.refElement(m);
            Assert.AreEqual(xmPart.getMedia(), m);
            mPart.put("Side", "Back");
            xmPart = (JDFExposedMedia)xm.getCreatePartition(mPart, null);
            JDFMedia medPart = (JDFMedia)m.getCreatePartition(mPart, xm.getPartIDKeys());

            xmPart.refElement(medPart);
            Assert.AreEqual(xmPart.getMedia(), medPart);
            JDFRefElement re = (JDFRefElement)xmPart.getElement("MediaRef");

            Assert.AreEqual(re.getPartMap(), mPart);
        }
コード例 #3
0
ファイル: JDFElementTest.cs プロジェクト: cip4/JDFLibNet
        public virtual void testRemoveChild()
        {
            JDFDoc  d = new JDFDoc("JDF");
            JDFNode n = d.getJDFRoot();

            n.setType("ConventionalPrinting", true);
            JDFExposedMedia xmpl = (JDFExposedMedia)n.appendMatchingResource("ExposedMedia", EnumProcessUsage.Plate, null);
            JDFExposedMedia xmpr = (JDFExposedMedia)n.appendMatchingResource("ExposedMedia", EnumProcessUsage.Proof, null);
            JDFMedia        m    = xmpr.appendMedia();

            Assert.IsNotNull(xmpr.getMedia());
            m.setID("id1");
            KElement t1 = n.getTarget("id1", "ID");

            m = (JDFMedia)m.makeRootResource(null, null, true);
            Assert.AreEqual(m, t1);
            Assert.IsNotNull(xmpr.getMedia());
            xmpl.refElement(m);
            Assert.IsNotNull(xmpl.getMedia());
            JDFResourcePool rp = n.getResourcePool();

            Assert.IsNotNull(rp.getElement("Media"));
            xmpl.removeChild("Media", null, 0);
            Assert.IsNull(xmpl.getMedia());
            Assert.IsNotNull(rp.getElement("Media"));
            xmpr.removeChildren("Media", null, null);
            Assert.IsNull(xmpr.getMedia());
            Assert.IsNotNull(rp.getElement("Media"));
        }
コード例 #4
0
ファイル: JDFPipeParamsTest.cs プロジェクト: cip4/JDFLibNet
        public virtual void testGetResource()
        {
            JDFDoc          doc = new JDFDoc(ElementName.JMF);
            JDFJMF          jmf = doc.getJMFRoot();
            JDFCommand      c   = jmf.appendCommand(EnumType.PipePull);
            JDFPipeParams   pp  = c.appendPipeParams();
            JDFExposedMedia xm  = (JDFExposedMedia)pp.appendResource(ElementName.EXPOSEDMEDIA);

            Assert.AreEqual(EnumResourceClass.Handling, xm.getResourceClass());
            JDFMedia m = (JDFMedia)pp.appendResource(ElementName.MEDIA);

            Assert.AreEqual(EnumResourceClass.Consumable, m.getResourceClass());
            JDFRefElement rm = xm.refElement(m);

            Assert.AreEqual(m, rm.getTarget());
            Assert.AreEqual(xm, pp.getResource(ElementName.EXPOSEDMEDIA));
            Assert.AreEqual(xm, pp.getResource(null));
            Assert.AreEqual(m, pp.getResource(ElementName.MEDIA));
            try
            {
                Assert.IsNull(pp.getResource("MediaLink"));
                Assert.Fail();
            }
            catch (JDFException)
            {
                // nop
            }

            JDFResourceLink rl = pp.appendResourceLink(ElementName.EXPOSEDMEDIA, true);

            rl.setrRef(xm.getID());
            Assert.AreEqual(xm, pp.getResource(null));
            Assert.AreEqual(rl.getTarget(), pp.getResource(null));
        }
コード例 #5
0
        public virtual void testMediaRef()
        {
            JDFDoc doc = new JDFDoc(ElementName.JMF);
            JDFJMF jmf = doc.getJMFRoot();

            JDFSignal s = jmf.appendSignal();

            jmf.setSenderID("DeviceSenderID");

            s.setType(EnumType.Resource);
            JDFResourceQuParams rqp = s.appendResourceQuParams();

            rqp.setJobID("JobID");
            rqp.setJobPartID("JobPartID");
            rqp.setResourceName(ElementName.EXPOSEDMEDIA);

            JDFResourceInfo ri = s.appendResourceInfo();
            JDFExposedMedia xm = (JDFExposedMedia)ri.appendElement("ExposedMedia");

            JDFResourceInfo ri2 = s.appendResourceInfo();
            JDFMedia        m   = (JDFMedia)ri2.appendElement("Media");
            JDFRefElement   rm  = xm.refElement(m);

            Assert.AreEqual(m, rm.getTarget(), "works initially ");
            Assert.AreEqual(m, rm.getTarget(), "also works with cache");
        }
コード例 #6
0
ファイル: JDFElementTest.cs プロジェクト: cip4/JDFLibNet
        public virtual void testGetRefElement()
        {
            JDFNode         n  = new JDFDoc("JDF").getJDFRoot();
            JDFMedia        m  = (JDFMedia)n.addResource("Media", null);
            JDFMedia        m1 = (JDFMedia)m.addPartition(EnumPartIDKey.Location, "T1");
            JDFMedia        m2 = (JDFMedia)m.addPartition(EnumPartIDKey.Location, "T2");
            JDFExposedMedia xm = (JDFExposedMedia)n.addResource("ExposedMedia", null);

            Assert.IsNull(xm.getRefElement(m1));
            JDFRefElement re = xm.refElement(m2);

            Assert.AreEqual(re, xm.getRefElement(m2));
            Assert.AreEqual(re, xm.getRefElement(m2));
            Assert.AreEqual(xm.getMedia(), m2);
            Assert.IsNull(xm.getRefElement(m1));
            Assert.IsNull(xm.getRefElement(m));
        }
コード例 #7
0
        ///
        ///	 * <param name="icsLevel"> </param>
        ///
        protected internal virtual void initPlateXM(EnumUsage usage)
        {
            JDFResourceLink rl = null;

            if (thePreviousNode != null) // either input (for cp, or output for
            // plateset)
            {
                rl = theNode.linkResource(thePreviousNode.getResource(ElementName.EXPOSEDMEDIA, null, 0), usage, null);
            }

            if (rl == null && theParentNode != null)
            {
                rl = theNode.ensureLink(theParentNode.getResource(ElementName.EXPOSEDMEDIA, null, 0), usage, null);
            }

            JDFExposedMedia xm = (JDFExposedMedia)theNode.getCreateResource(ElementName.EXPOSEDMEDIA, usage, 0);

            xm.setPartUsage(EnumPartUsage.Explicit);
            rl = theNode.getLink(xm, null);

            JDFMedia m = ((JDFExposedMedia)xm.getLeaves(false)[0]).getMedia();

            if (m == null)
            {
                m = initPlateMedia();
            }
            else
            {
                m = (JDFMedia)m.getResourceRoot();
                if (theParentNode != null)
                {
                    theNode.ensureLink(theParentNode.getResource("Media", EnumUsage.Input, 0), EnumUsage.Input, null);
                }
            }
            xm.setResStatus(EnumResStatus.Unavailable, false);
            if (!bPartitionedPlateMedia && xm.getMedia() == null)
            {
                xm.refElement(m);
            }
            if (EnumUsage.Input.Equals(usage))
            {
                rl.setProcessUsage(EnumProcessUsage.Plate);
                JDFResourceLink link = theNode.getLink(m, null);
                if (link != null)
                {
                    link.deleteNode();
                }
            }

            if (vParts != null)
            {
                for (int i = 0; i < vParts.Count; i++)
                {
                    JDFAttributeMap part  = new JDFAttributeMap(vParts[i]);
                    JDFResource     xmp   = xm.getCreatePartition(part, partIDKeys);
                    int             ncols = "Front".Equals(part.get("Side")) ? nCols[0] : nCols[1];

                    for (int j = 0; j < ncols; j++)
                    {
                        part.put(EnumPartIDKey.Separation, cols.stringAt(j));
                        xmp.getCreatePartition(part, partIDKeys);
                    }
                }
                if (bPartitionedPlateMedia)
                {
                    VJDFAttributeMap vSheets = getReducedMap(new VString("Side Separation PartVersion", null));
                    for (int i = 0; i < vSheets.Count; i++)
                    {
                        JDFAttributeMap part = new JDFAttributeMap(vSheets[i]);
                        JDFExposedMedia xmp  = (JDFExposedMedia)xm.getCreatePartition(part, partIDKeys);
                        if (xmp.getMedia() == null)
                        {
                            xmp.refMedia((JDFMedia)m.getCreatePartition(part, null));
                        }
                    }
                }
            }
        }