Exemple #1
0
        public virtual void testgetMatchingElementsFromParentSingle()
        {
            JDFDoc    ddc = new JDFDoc("DevCap");
            JDFDoc    dde = new JDFDoc("Layout");
            JDFDevCap dc  = (JDFDevCap)ddc.getRoot();
            JDFLayout e   = (JDFLayout)dde.getRoot();

            JDFDevCap dc1 = dc.appendDevCap();

            dc1.setName("Media");
            dc1.setMaxOccurs(1);
            dc1.setMinOccurs(1);

            for (int i = 0; i < 2; i++)
            {
                string mediaType = i == 0 ? "Paper" : "Plate";
                e.appendElement("Media").setAttribute("MediaType", mediaType);
            }
            VElement devCapVector = dc.getDevCapVector(null, true);
            VElement vMatch       = ((JDFDevCap)devCapVector.item(0)).getMatchingElementsFromParent(e, devCapVector);

            Assert.AreEqual(2, vMatch.Count);
            Assert.AreEqual(e.getElement("Media", null, 0), vMatch.item(0));
            Assert.AreEqual(e.getElement("Media", null, 1), vMatch.item(1));
        }
Exemple #2
0
 public virtual void testGetSignatureByName()
 {
     for (int i = 0; i < 2; i++)
     {
         if (i == 0)
         {
             testBuildNewLayout();
         }
         else
         {
             testBuildOldLayout();
             JDFLayout lo = (JDFLayout)n.getMatchingResource(ElementName.LAYOUT, EnumProcessUsage.AnyInput, null, 0);
             lo.getSignature(0).setName("SignatureName1");
             lo.getSignature(1).setName("SignatureName2");
             lo.getSignature(1).getSheet(0).setName("SheetName1");
         }
         JDFLayout lo_1 = (JDFLayout)n.getMatchingResource(ElementName.LAYOUT, EnumProcessUsage.AnyInput, null, 0);
         Assert.IsNull(lo_1.getSignature("fooBar"));
         Assert.AreEqual(lo_1.getSignature("SignatureName1"), lo_1.getSignature(0));
         Assert.AreEqual(lo_1.getSheet("SheetName1"), lo_1.getSheet(0));
         JDFSignature signature2 = lo_1.getSignature("SignatureName2");
         Assert.AreEqual(signature2.getSheet("SheetName1"), lo_1.getSignature(1).getSheet(0));
         Assert.AreEqual(lo_1.getCreateSignature("fooBar"), lo_1.getSignature(-1));
     }
 }
Exemple #3
0
        public virtual void testgetMatchingElementsFromParentMulti()
        {
            JDFDoc    ddc = new JDFDoc("DevCap");
            JDFDoc    dde = new JDFDoc("Layout");
            JDFDevCap dc  = (JDFDevCap)ddc.getRoot();
            JDFLayout e   = (JDFLayout)dde.getRoot();

            for (int i = 0; i < 2; i++)
            {
                JDFDevCap dc1 = dc.appendDevCap();
                dc1.setName("Media");
                dc1.setMaxOccurs(1);
                dc1.setMinOccurs(1);
                JDFEnumerationState es = dc1.appendEnumerationState("MediaType");
                string mediaType       = i == 0 ? "Paper" : "Plate";
                es.setAllowedValueList(new VString(mediaType, null));

                e.appendElement("Media").setAttribute("MediaType", mediaType);
            }
            VElement devCapVector = dc.getDevCapVector(null, true);

            for (int i = 0; i < 2; i++)
            {
                VElement vMatch = ((JDFDevCap)devCapVector.item(i)).getMatchingElementsFromParent(e, devCapVector);
                Assert.AreEqual(1, vMatch.Count);
                Assert.AreEqual(e.getElement("Media", null, i), vMatch.item(0));
            }
        }
Exemple #4
0
        ///
        ///	 <summary> *  </summary>
        ///
        private void executeLayout()
        {
            JDFLayout lo = (JDFLayout)theExpandedNode.getResource(ElementName.LAYOUT, EnumUsage.Output, 0);

            if (lo != null && vParts != null)
            {
                VJDFAttributeMap reducedMap = getReducedMap(new VString("Separation PartVersion", " "));
                lo.setResStatus(EnumResStatus.Available, true);
                if (reducedMap != null)
                {
                    int size = reducedMap.Count;
                    for (int i = 0; i < size; i++)
                    {
                        JDFAttributeMap part = reducedMap[i];
                        if (bSingleSided == true && "Back".Equals(part.get("Side")))
                        {
                            continue;
                        }

                        JDFLayout partLO = (JDFLayout)lo.getCreatePartition(part, partIDKeys);
                        for (int j = 0; j < 4; j++)
                        {
                            JDFContentObject co = partLO.appendContentObject();
                            co.setCTM(new JDFMatrix(1 + 10 * j, 2 + 20 * j, 3 + 30 * j, 4 + 40 * j, 5 + 50 * j, 6 + 0 * j));
                            co.setOrd(j + i * 4);
                        }
                    }
                }
            }
        }
Exemple #5
0
        ///
        ///	 <summary> * get a specific layout element
        ///	 *  </summary>
        ///	 * <param name="layout"> </param>
        ///	 * <param name="elementName"> </param>
        ///	 * <param name="partitionKeyName"> </param>
        ///	 * <param name="iSkip"> the index of the element, negative values count backwards from the end </param>
        ///	 * <returns> JDFLayout: the element </returns>
        ///
        protected internal static JDFLayout getLayoutElement(JDFResource layout, string elementName, string partitionKeyName, int iSkip)
        {
            int iSkipLocal = iSkip;

            JDFLayout s = null;

            if (JDFLayout.isNewLayout(layout))
            {
                VElement v  = layout.getLeaves(true);
                VElement v2 = new VElement();
                for (int i = 0; i < v.Count; i++)
                {
                    if (v[i].hasAttribute_KElement(partitionKeyName, null, false))
                    {
                        v2.Add(v[i]);
                    }
                }
                v = v2;
                if (iSkipLocal < 0)
                {
                    iSkipLocal = v.Count + iSkipLocal;
                }

                if (iSkipLocal >= 0 && v.Count > iSkipLocal)
                {
                    s = (JDFLayout)v[iSkipLocal];
                }
            }
            else
            {
                s = (JDFLayout)layout.getElement(elementName, null, iSkipLocal);
            }
            return(s);
        }
Exemple #6
0
        public virtual void testAutoRegister()
        {
            Assert.AreEqual(EnumVersion.Version_1_3, n.getVersion(false), "version ok");
            JDFLayout            lo      = (JDFLayout)n.appendMatchingResource(ElementName.LAYOUT, EnumProcessUsage.AnyInput, null);
            JDFColorControlStrip autoReg = lo.appendMarkObject().appendColorControlStrip();

            autoReg.setStripType("AutoRegister");
            autoReg.appendElement("SeparationSpec").setAttribute("Name", "Black");
            autoReg.appendElement("SeparationSpec").setAttribute("Name", "Cyan");
            autoReg.appendElement("SeparationSpec").setAttribute("Name", "Yellow");
            autoReg.appendElement("SeparationSpec").setAttribute("Name", "Magenta");
            autoReg.appendElement("SeparationSpec").setAttribute("Name", "Spot1");
            autoReg.appendElement("SeparationSpec").setAttribute("Name", "Spot2");
            JDFColorControlStrip fms = lo.getMarkObject(0).appendColorControlStrip();

            fms.setStripType("FMS");
            fms.appendElement("SeparationSpec").setAttribute("Name", "Black");
            fms.appendElement("SeparationSpec").setAttribute("Name", "Yellow");
            fms.appendElement("SeparationSpec").setAttribute("Name", "Magenta");
            fms.appendElement("SeparationSpec").setAttribute("Name", "Cyan");

            fms = lo.getMarkObject(0).appendColorControlStrip();
            fms.setStripType("FMS");
            fms.appendElement("SeparationSpec").setAttribute("Name", "Spot1");
            fms.appendElement("SeparationSpec").setAttribute("Name", "Spot2");
            doc.write2File(sm_dirTestDataTemp + "autoregister.jdf", 2, false);
        }
Exemple #7
0
        ///
        ///	 * <param name="media"> </param>
        ///	 * <param name="sNode">
        ///	 * @return </param>
        ///
        private JDFMedia getMediaFromNode(JDFNode sNode)
        {
            if (sNode == null)
            {
                return(null);
            }
            JDFLayout lo = (JDFLayout)sNode.getResource(ElementName.LAYOUT, EnumUsage.Input, 0);

            if (lo != null)
            {
                JDFMedia m = lo.getMedia(0);
                if (m != null)
                {
                    return(m);
                }
            }

            JDFStrippingParams sp = (JDFStrippingParams)sNode.getResource(ElementName.STRIPPINGPARAMS, EnumUsage.Input, 0);

            if (sp != null)
            {
                return(sp.getMedia(0));
            }
            return(null);
        }
Exemple #8
0
        public virtual void testGetMedia()
        {
            JDFLayout lo    = (JDFLayout) new JDFDoc("JDF").getRoot().appendElement(ElementName.RESOURCEPOOL).appendElement(ElementName.LAYOUT);
            JDFLayout s1    = (JDFLayout)lo.addPartition(EnumPartIDKey.SheetName, "s1");
            JDFMedia  media = lo.appendMedia();

            media.setMediaType(EnumMediaType.Plate);
            Assert.IsNull(lo.getMedia(EnumMediaType.Paper));
            Assert.IsNull(s1.getMedia(EnumMediaType.Paper));
            Assert.AreEqual(s1.getMedia(EnumMediaType.Plate), media);
            Assert.AreEqual(lo.getMedia(EnumMediaType.Plate), media);

            JDFMedia media2 = s1.appendMedia();

            media2.setMediaType(EnumMediaType.Paper);
            Assert.IsNull(s1.getMedia(EnumMediaType.Plate));
            Assert.AreEqual(s1.getMedia(EnumMediaType.Paper), media2);
            JDFMedia media3 = s1.appendMedia();

            media3.setMediaType(EnumMediaType.Plate);
            Assert.AreEqual(s1.getMedia(EnumMediaType.Paper), media2);
            Assert.AreEqual(s1.getMedia(EnumMediaType.Plate), media3);
            media3.makeRootResource(null, null, true);
            Assert.AreEqual(s1.getMedia(EnumMediaType.Paper), media2);
            Assert.AreEqual(s1.getMedia(EnumMediaType.Plate), media3);
        }
Exemple #9
0
        public virtual void testGetSignatureVector_Old()
        {
            testBuildOldLayout();
            JDFLayout    lo  = (JDFLayout)n.getMatchingResource(ElementName.LAYOUT, EnumProcessUsage.AnyInput, null, 0);
            VElement     v   = lo.getSignatureVector();
            JDFSignature sig = (JDFSignature)v[0];

            Assert.AreEqual(sig.getName(), sig.getSignatureName());
            Assert.AreEqual("Sig1", sig.getSignatureName());
            JDFSignature sig2 = (JDFSignature)v[1];

            Assert.AreEqual(sig2.getName(), sig2.getSignatureName());
            Assert.AreEqual("Sig2", sig2.getSignatureName());
            VElement vSheet = sig2.getSheetVector();
            JDFSheet s1     = (JDFSheet)vSheet[1]; // don't try 0 it will

            // fail because it is
            // referenced...
            Assert.AreEqual("Sig2", s1.getSignatureName());
            Assert.AreEqual("Sheet2_2", s1.getSheetName());
            JDFSurface su = s1.getCreateBackSurface();

            Assert.AreEqual("Sig2", su.getSignatureName());
            Assert.AreEqual("Sheet2_2", su.getSheetName());
            Assert.AreEqual(su, s1.getSurfaceVector()[0]);
        }
Exemple #10
0
 ///
 ///	 <summary> * get a vector of specific layout elements
 ///	 *  </summary>
 ///	 * <param name="layout"> </param>
 ///	 * <param name="elementName"> </param>
 ///	 * <param name="partitionKeyName"> </param>
 ///	 * <returns> VElement: the vector of elements </returns>
 ///
 protected internal static VElement getLayoutElementVector(JDFResource layout, string elementName, string partitionKeyName)
 {
     if (JDFLayout.isNewLayout(layout))
     {
         return(layout.getChildElementVector_JDFElement(ElementName.LAYOUT, null, new JDFAttributeMap(partitionKeyName, (string)null), true, 0, true));
     }
     return(layout.getChildElementVector_JDFElement(elementName, null, null, true, 0, true));
 }
Exemple #11
0
 ///
 ///	 <summary> * (31) create inter-resource link to refTarget
 ///	 *  </summary>
 ///	 * <param name="JDFSurface">
 ///	 *            refTarget the element that is referenced </param>
 ///
 public virtual void refSurface(JDFSurface refTarget)
 {
     if (JDFLayout.isNewLayout(this))
     {
         throw new JDFException("refSheet: attempting to reference a partition");
     }
     refElement(refTarget);
 }
Exemple #12
0
 ///
 ///	 <summary> * get the leaves of a layout, either pre 1.2 or post 1.3
 ///	 *  </summary>
 ///	 * <returns> VElement the layout leaves, i.e. partition leaves(1.3+) or explicit surfaces(1.2-) </returns>
 ///
 public virtual VElement getLayoutLeaves(bool bAll)
 {
     if (JDFLayout.isNewLayout(this))
     {
         return(getLeaves(bAll));
     }
     return(getChildrenByTagName(ElementName.SURFACE, null, null, false, true, -1));
 }
Exemple #13
0
        public virtual void testProcessUsage()
        {
            JDFDoc  d = new JDFDoc("JDF");
            JDFNode n = d.getJDFRoot();

            n.setType("fnarf", false);

            EnumFitsValue       testlists  = EnumFitsValue.Allowed;
            EnumValidationLevel level      = KElement.EnumValidationLevel.Complete;
            VElement            vExecNodes = devicecap.getExecutableJDF(n, testlists, level);

            Assert.IsNull(vExecNodes, "missing resources");

            JDFLayout lo = (JDFLayout)n.addResource(ElementName.LAYOUT, null, EnumUsage.Input, null, null, null, null);

            lo.appendContentObject().setCTM(new JDFMatrix("1 0 0 1 0 0"));
            lo.appendContentObject().setCTM(new JDFMatrix("1 0 0 1 10 20"));

            JDFRunList rlDoc = (JDFRunList)n.addResource(ElementName.RUNLIST, null, EnumUsage.Input, EnumProcessUsage.Document, null, null, null);

            vExecNodes = devicecap.getExecutableJDF(n, testlists, level);
            Assert.IsNotNull(vExecNodes, "no missing resources");

            n.addResource(ElementName.RUNLIST, null, EnumUsage.Input, EnumProcessUsage.Marks, null, null, null);
            vExecNodes = devicecap.getExecutableJDF(n, testlists, level);
            Assert.IsNotNull(vExecNodes, "no missing resources");

            JDFResourceLink rl = n.getLink(rlDoc, null);

            rl.setUsage(EnumUsage.Output);
            vExecNodes = devicecap.getExecutableJDF(n, testlists, level);
            Assert.IsNull(vExecNodes, "no required runlist doc");

            rl.setUsage(EnumUsage.Input);
            vExecNodes = devicecap.getExecutableJDF(n, testlists, level);
            Assert.IsNotNull(vExecNodes, "no required runlist doc");

            JDFDevCaps   dcsRLDoc = devicecap.getDevCapsByName("RunList", null, null, EnumProcessUsage.Document, 0);
            JDFNameState ns       = dcsRLDoc.getDevCap().appendNameState("RunTag");

            ns.setRequired(true);

            vExecNodes = devicecap.getExecutableJDF(n, testlists, level);
            Assert.IsNull(vExecNodes, "incomplete required runlist doc");

            ns.setRequired(false);
            vExecNodes = devicecap.getExecutableJDF(n, testlists, level);
            Assert.IsNotNull(vExecNodes, "incomplete required runlist doc");

            JDFDevCaps   dcsRLMarks = devicecap.getDevCapsByName("RunList", null, null, EnumProcessUsage.Marks, 0);
            JDFNameState nsMarks    = dcsRLMarks.getDevCap().appendNameState("PageNames");

            nsMarks.setRequired(true);

            vExecNodes = devicecap.getExecutableJDF(n, testlists, level);
            Assert.IsNull(vExecNodes, "incomplete required runlist marks");
        }
Exemple #14
0
        public virtual void testBuildNewLayout()
        {
            reset();

            JDFLayout lo = (JDFLayout)n.appendMatchingResource(ElementName.LAYOUT, EnumProcessUsage.AnyInput, null);

            Assert.IsTrue(JDFLayout.isNewLayout(lo), "lo 1.3");
            JDFSignature si = lo.appendSignature();

            Assert.AreEqual(ElementName.LAYOUT, si.LocalName, "signature name");
            si = lo.appendSignature();
            Assert.AreEqual(2, lo.numSignatures(), "num sigs");
            Assert.AreEqual(ElementName.LAYOUT, si.LocalName, "signature name");

            JDFSheet sh = si.appendSheet();

            sh = si.appendSheet();
            Assert.AreEqual(2, si.numSheets(), "num sheets");
            Assert.AreEqual(ElementName.LAYOUT, sh.LocalName, "sheet name");
            sh = si.getCreateSheet(4);
            Assert.AreEqual(3, si.numSheets(), "num sheets");
            Assert.AreEqual(ElementName.LAYOUT, sh.LocalName, "sheet name");
            sh = si.getSheet(2);
            Assert.AreEqual(3, si.numSheets(), "num sheets");
            Assert.AreEqual(ElementName.LAYOUT, sh.LocalName, "sheet name");

            JDFSurface su = sh.appendFrontSurface();

            Assert.AreEqual(1, sh.numSurfaces(), "num surfaces");
            Assert.AreEqual(ElementName.LAYOUT, su.LocalName, "sheet name");
            Assert.IsTrue(sh.hasFrontSurface(), "hasfrontSurface");

            su = sh.appendBackSurface();
            Assert.AreEqual(2, sh.numSurfaces(), "num surfaces");
            Assert.AreEqual(ElementName.LAYOUT, su.LocalName, "sheet name");

            try
            {
                sh.appendBackSurface();
                Assert.Fail("no two back surfaces");
            }
            catch (JDFException)
            { // nop
            }

            si = lo.getCreateSignature(4);
            Assert.AreEqual(3, lo.numSignatures(), "num sigs");
            Assert.AreEqual(ElementName.LAYOUT, si.LocalName, "signature name");
            si = lo.getSignature(2);
            Assert.AreEqual(3, lo.numSignatures(), "num sigs");
            Assert.AreEqual(ElementName.LAYOUT, si.LocalName, "signature name");
            si = lo.getSignature(5);
            Assert.IsNull(si, "si null");
            Assert.IsTrue(lo.isValid(EnumValidationLevel.Complete), "layout valid");
            Assert.AreEqual(lo.numSignatures(), lo.getSignatureVector().Count);
        }
Exemple #15
0
        public virtual void testAutomateLayout1()
        {
            n.setXMLComment("This is the simplest example of an automated layout\n" + "The structure is aligned as closely as possible with a static Layout\n" + "note that the actual processes and outputs have been omitted for brevity");

            setUpAutomatedInputRunList();
            rl.setDescriptiveName("This is a RunList specifiying 100 instance documents of 14 pages each in a ppml file");

            lo = (JDFLayout)n.appendMatchingResource(ElementName.LAYOUT, EnumProcessUsage.AnyInput, null);
            lo.setResStatus(EnumResStatus.Available, true);

            lo.setMaxOrd(14);
            lo.setMaxDocOrd(1);
            lo.setAutomated(true);
            lo.appendXMLComment("Layout for 2 Cover pages and 12 2 up two sided body pages\n The number of pages per instance document is fixed\n" + "This Layout is an example of an 'almost conventional' automated layout\n" + "MaxDocOrd is set to 1. This is redundant since 1 is the default.\n" + "A value of 1 explicitly resets all counters at a Document break.", null);
            JDFLayout cover = (JDFLayout)lo.addPartition(EnumPartIDKey.SheetName, "Cover");

            cover.setDescriptiveName("one sided cover - the inner = back side is empty");
            JDFLayout        coverFront = (JDFLayout)cover.addPartition(EnumPartIDKey.Side, EnumSide.Front);
            JDFContentObject co         = coverFront.appendContentObject();

            co.setCTM(new JDFMatrix(1, 0, 0, 1, 0, 0));
            co.setOrd(13);
            co.setDescriptiveName("Front Cover Page");
            co = coverFront.appendContentObject();
            co.setCTM(new JDFMatrix(1, 0, 0, 1, 8.5 * 72, 0));
            co.setOrd(0);
            co.setDescriptiveName("Back Cover Page - (back of brochure but front of sheet)");

            for (int i = 0; i < 3; i++)
            {
                JDFLayout body = (JDFLayout)lo.addPartition(EnumPartIDKey.SheetName, "Body" + (i + 1));
                body.setDescriptiveName("sheet " + (i + 1) + " of 3 of the insert");
                JDFLayout bodySide = (JDFLayout)body.addPartition(EnumPartIDKey.Side, EnumSide.Front);

                co = bodySide.appendContentObject();
                co.setCTM(new JDFMatrix(1, 0, 0, 1, 0, 0));
                co.setOrd(8 + 2 * (2 - i));
                co.setDescriptiveName("Left Front Sheet Body Page");
                co = bodySide.appendContentObject();
                co.setCTM(new JDFMatrix(1, 0, 0, 1, 8.5 * 72, 0));
                co.setOrd(1 + (2 * i));
                co.setDescriptiveName("Right Front Sheet Body Page");

                bodySide = (JDFLayout)body.addPartition(EnumPartIDKey.Side, EnumSide.Back);

                co = bodySide.appendContentObject();
                co.setCTM(new JDFMatrix(1, 0, 0, 1, 0, 0));
                co.setOrd(2 + (2 * i));
                co.setDescriptiveName("Left Back Sheet Body Page");
                co = bodySide.appendContentObject();
                co.setCTM(new JDFMatrix(1, 0, 0, 1, 8.5 * 72, 0));
                co.setOrd(7 + 2 * (2 - i));
                co.setDescriptiveName("Right Back Sheet Body Page");
            }
            doc.write2File(sm_dirTestDataTemp + "AutomatedLayout1.jdf", 2, false);
        }
Exemple #16
0
        public virtual void testAutomateLayout2()
        {
            n.setXMLComment("This another example of an automated layout\n" + "The structure is aligned close to a static Layout but additionally uses OrdExpression and allows for varying numbers of pages in the runlist\n" + "note that the actual processes and outputs have been omitted for brevity");

            setUpAutomatedInputRunList();
            rl.setDescriptiveName("This is a RunList specifiying 100 instance documents of varying pages each in a ppml file");

            lo = (JDFLayout)n.appendMatchingResource(ElementName.LAYOUT, EnumProcessUsage.AnyInput, null);
            lo.setResStatus(EnumResStatus.Available, true);

            lo.setMaxDocOrd(1);
            lo.setAutomated(true);
            lo.appendXMLComment("Layout for 2 Cover pages and varying numbers of 2 up two sided body pages\n" + "The number of pages per instance document varies\n" + "MaxDocOrd is set to 1. This is redundant since 1 is the default.\n" + "A value of 1 explicitly resets all counters at a Document break.", null);
            JDFLayout cover = (JDFLayout)lo.addPartition(EnumPartIDKey.SheetName, "Cover");

            cover.appendXMLComment("In this example, the cover is assumed to be the first two pages of each runlist\n" + "\n!!! We unfortunately have an issue here:\n" + "we cannot differentiate whether the cover should be repeated of not, i.e. whether the cover is executed once (the correct choice) or repeated between each body sheet.\n" + "Note that no MaxOrd is not set, as it varies between documents", null);
            cover.setDescriptiveName("one sided cover - the inner = back side is empty");
            JDFLayout        coverFront = (JDFLayout)cover.addPartition(EnumPartIDKey.Side, EnumSide.Front);
            JDFContentObject co         = coverFront.appendContentObject();

            co.setCTM(new JDFMatrix(1, 0, 0, 1, 0, 0));
            co.setOrdExpression("1");
            co.setDescriptiveName("Front Cover Page");
            co = coverFront.appendContentObject();
            co.setCTM(new JDFMatrix(1, 0, 0, 1, 8.5 * 72, 0));
            co.setOrdExpression("0");
            co.setDescriptiveName("Back Cover Page - (back of brochure but front of sheet)");

            JDFLayout body = (JDFLayout)lo.addPartition(EnumPartIDKey.SheetName, "Body");

            body.setDescriptiveName("abstract description of multiple body sheets");
            JDFLayout bodySide = (JDFLayout)body.addPartition(EnumPartIDKey.Side, EnumSide.Front);

            co = bodySide.appendContentObject();
            co.setCTM(new JDFMatrix(1, 0, 0, 1, 0, 0));
            co.setOrdExpression("4 * (n+3)/4 - s*2 +1");
            co.setDescriptiveName("Left Front Sheet Body Page");
            co = bodySide.appendContentObject();
            co.setCTM(new JDFMatrix(1, 0, 0, 1, 8.5 * 72, 0));
            co.setOrdExpression("2*s +2");
            co.setDescriptiveName("Right Front Sheet Body Page");

            bodySide = (JDFLayout)body.addPartition(EnumPartIDKey.Side, EnumSide.Back);

            co = bodySide.appendContentObject();
            co.setCTM(new JDFMatrix(1, 0, 0, 1, 0, 0));
            co.setOrdExpression("2*s +3");
            co.setDescriptiveName("Left Back Sheet Body Page");
            co = bodySide.appendContentObject();
            co.setCTM(new JDFMatrix(1, 0, 0, 1, 8.5 * 72, 0));
            co.setOrdExpression("4 * (n+3)/4 - s*2 +0");
            co.setDescriptiveName("Right Back Sheet Body Page");

            doc.write2File(sm_dirTestDataTemp + "AutomatedLayout2.jdf", 2, false);
        }
Exemple #17
0
        public virtual void testMedia()
        {
            JDFLayout lo = (JDFLayout)n.appendMatchingResource(ElementName.LAYOUT, EnumProcessUsage.AnyInput, null);

            lo.appendMedia();
            JDFMedia m2 = lo.appendMedia();

            Assert.IsNotNull(m2, "2. Media ok");
            Assert.AreEqual(m2, lo.getMedia(1));
            Assert.AreEqual(m2, lo.getCreateMedia(1));
        }
Exemple #18
0
        public virtual void testGeneratedObject()
        {
            n = doc.getJDFRoot();
            JDFLayout  lo  = (JDFLayout)n.addResource("Layout", null, EnumUsage.Input, null, null, null, null);
            JDFRunList rlo = (JDFRunList)n.addResource("RunList", null, EnumUsage.Output, null, null, null, null);

            rlo.setFileURL("output.pdf");

            lo.appendXMLComment("This is a simple horizontal slug line\nAnchor specifies which of the 9 coordinates is the 0 point for the coordinate system specified in the CTM\nThis slugline describes error and endtime in the lower left corner of the scb", null);
            JDFMarkObject mark = lo.appendMarkObject();

            mark.setCTM(new JDFMatrix("1 0 0 1 0 0"));
            JDFJobField jf = mark.appendJobField();

            jf.setShowList(new VString("Error EndTime", " "));

            lo.appendXMLComment("This is a simple vertical slug line\nAnchor specifies which of the 9 coordinates is the 0 point for the coordinate system specified in the CTM\nThis slugline describes the operator name along the right side of the sheet text from top to bottom\nthe slug line (top right of the slug cs) is anchored in the bottom right of the sheet.\nNote that the coordinates in the ctm are guess work. the real coordinates are left as an exercise for the reader;-)", null);
            mark = lo.appendMarkObject();
            mark.setCTM(new JDFMatrix("0 1 -1 0 555 444"));
            jf = mark.appendJobField();
            jf.setShowList(new VString("Operator", " "));
            JDFDeviceMark dm = jf.appendDeviceMark();

            dm.setAttribute("Anchor", "TopRight");
            dm.setFont("Arial");
            dm.setFontSize(10);

            lo.appendXMLComment("This is a formatted vertical slug line\nAnchor specifies which of the 9 coordinates is the 0 point for the coordinate system specified in the CTM\nThis slugline describes a formatted line along the left side of the sheet text from top to bottom\nthe slug line (top left) is anchored in the bottom left of the sheet.\nThe text is defined in @Format with the sequence in ShowList defining the 5 placeholders marked by %s or %i\nAn example instance would be: \"This Cyan plate of Sheet1 was proudly produced by Joe Cool! Resolution: 600 x 600\"\nNote that the coordinates in the ctm are guess work. the real coordinates are left as an exercise for the reader;-)", null);
            mark = lo.appendMarkObject();
            mark.setCTM(new JDFMatrix("0 1 -1 0 0 0"));
            jf = mark.appendJobField();
            jf.setShowList(new VString("Separation SheetName Operator ResolutionX ResolutionY", " "));
            jf.setAttribute("Format", "This %s plate of %s was proudly produced by %s!\nResolution: %i x %i");
            dm = jf.appendDeviceMark();
            dm.setAttribute("Anchor", "TopLeft");
            dm.setFont("Arial");
            dm.setFontSize(10);

            lo.appendXMLComment("This is a positioned registermark\nthe center of the mark is translated by 666 999\n the JobField is empty and serves aa a Marker that no external Content is requested", null);
            mark = lo.appendMarkObject();
            mark.setCTM(new JDFMatrix("1 0 0 1 666 999"));
            jf = mark.appendJobField();
            mark.appendXMLComment("The coordinate system origin is defined by the anchor in the center, i.e. 0 0\n the separartions are excluding black", null);
            JDFRegisterMark rm = mark.appendRegisterMark();

            rm.setMarkType("Arc Cross");
            rm.setMarkUsage(EnumMarkUsage.Color);
            rm.setCenter(new JDFXYPair("0 0"));
            rm.setSeparations(new VString("Cyan Magent Yellow", " "));
            dm = jf.appendDeviceMark();
            dm.setAttribute("Anchor", "Center");

            doc.write2File(sm_dirTestDataTemp + "generatedObject.jdf", 2, false);
        }
Exemple #19
0
        public virtual void testFixFromNewLayout()
        {
            testBuildNewLayout();
            n.fixVersion(EnumVersion.Version_1_2);
            JDFLayout lo = (JDFLayout)n.getMatchingResource(ElementName.LAYOUT, EnumProcessUsage.AnyInput, null, 0);

            Assert.IsFalse(JDFLayout.isNewLayout(lo));
            JDFSignature si = lo.getSignature(0);

            Assert.AreEqual(ElementName.SIGNATURE, si.LocalName);
        }
Exemple #20
0
        public virtual void testFixToNewLayout()
        {
            testBuildOldLayout();
            n.fixVersion(EnumVersion.Version_1_3);
            JDFLayout lo = (JDFLayout)n.getMatchingResource(ElementName.LAYOUT, EnumProcessUsage.AnyInput, null, 0);

            Assert.IsTrue(JDFLayout.isNewLayout(lo));
            JDFSignature si = lo.getSignature(0);

            Assert.AreEqual("Sig1", si.getSignatureName());
            Assert.IsFalse(si.hasAttribute(AttributeName.CLASS));
        }
Exemple #21
0
        public virtual void testIsNewLayout()
        {
            Assert.AreEqual(EnumVersion.Version_1_3, n.getVersion(false), "version ok");
            JDFLayout lo = (JDFLayout)n.appendMatchingResource(ElementName.LAYOUT, EnumProcessUsage.AnyInput, null);

            Assert.IsTrue(JDFLayout.isNewLayout(lo), "lo 1.3");
            n.setVersion(EnumVersion.Version_1_2);
            Assert.IsFalse(JDFLayout.isNewLayout(lo), "lo 1.3");
            lo.addPartition(EnumPartIDKey.SheetName, "Sheet1");
            Assert.IsTrue(JDFLayout.isNewLayout(lo), "lo 1.3");
            Assert.IsFalse(JDFLayout.isNewLayout(rl), "l no layout");
        }
Exemple #22
0
        public virtual void testFixVersionProblem()
        {
            JDFParser p = new JDFParser();
            JDFDoc    d = p.parseFile(sm_dirTestData + "FixVersionProblem.jdf");

            Assert.IsNotNull(d, "FixVersionProblem exists");
            n = d.getJDFRoot();
            n.fixVersion(EnumVersion.Version_1_2);
            JDFLayout lo = (JDFLayout)n.getResourcePool().getElement(ElementName.LAYOUT, null, 0);

            Assert.AreEqual(1, lo.numChildElements("Signature", null));
        }
Exemple #23
0
        ///
        ///	 <summary> *  </summary>
        ///
        private void initOutputLayout()
        {
            JDFLayout lo = (JDFLayout)theNode.getCreateResource(ElementName.LAYOUT, EnumUsage.Output, 0);

            lo.setResStatus(EnumResStatus.Unavailable, false);
            VString vSigSheetSide = new VString("SignatureName SheetName Side", null);

            lo.setPartIDKeys(vSigSheetSide);
            for (int i = 0; i < vParts.Count; i++)
            {
                lo.getCreatePartition(vParts[i], vSigSheetSide);
            }
        }
Exemple #24
0
        public virtual void testGetPlacedObjectVector()
        {
            testBuildOldLayout();
            JDFLayout  lo = (JDFLayout)n.getMatchingResource(ElementName.LAYOUT, EnumProcessUsage.AnyInput, null, 0);
            JDFSurface su = lo.getSignature(1).getSheet(2).getSurface(EnumSide.Front);
            VElement   v  = su.getPlacedObjectVector();

            Assert.AreEqual(v.Count, 4);
            Assert.IsTrue(v[0] is JDFContentObject);
            Assert.IsTrue(v[1] is JDFMarkObject);
            Assert.IsTrue(v[2] is JDFContentObject);
            Assert.IsTrue(v[3] is JDFContentObject);
        }
Exemple #25
0
        ///
        ///	 <summary> * get a specific layout element by name
        ///	 *  </summary>
        ///	 * <param name="layout"> </param>
        ///	 * <param name="elementName"> </param>
        ///	 * <param name="partitionKeyName"> </param>
        ///	 * <param name="objectName">  </param>
        ///	 * <returns> JDFLayout: the element </returns>
        ///
        protected internal static JDFLayout getLayoutElement(JDFResource layout, string elementName, string partitionKeyName, string objectName)
        {
            JDFLayout s = null;

            if (JDFLayout.isNewLayout(layout))
            {
                s = (JDFLayout)layout.getPartition(new JDFAttributeMap(partitionKeyName, objectName), null);
            }
            else
            {
                s = (JDFLayout)layout.getChildWithAttribute(elementName, AttributeName.NAME, null, objectName, 0, true);
            }
            return(s);
        }
Exemple #26
0
        ///
        ///	 <summary> * appends a signature in both old and new Layouts if old: a <code>< Signature></code> element if new: a
        ///	 * SignatureName partition leaf </summary>
        ///	 * <param name="layout">  </param>
        ///	 * <param name="elementName">  </param>
        ///	 * <param name="partitionKeyName">
        ///	 *  </param>
        ///	 * <returns> JDFLayout </returns>
        ///	 * <exception cref="JDFException">  </exception>
        ///
        protected internal static JDFLayout appendLayoutElement(JDFResource layout, string elementName, string partitionKeyName)
        {
            JDFLayout s = null;

            if (JDFLayout.isNewLayout(layout))
            {
                int n = 1 + numLayoutElements(layout, elementName, partitionKeyName);
                s = (JDFLayout)layout.addPartition(EnumPartIDKey.getEnum(partitionKeyName), partitionKeyName + Convert.ToString(n));
            }
            else
            {
                s = (JDFLayout)layout.appendElement(elementName);
            }
            return(s);
        }
Exemple #27
0
        public virtual void testSetDefaultsFromCaps()
        {
            JDFDoc  d = new JDFDoc("JDF");
            JDFNode n = d.getJDFRoot();

            n.setType("fnarf", false);
            devicecap.setDefaultsFromCaps(n, true, false);
            Assert.IsNotNull(n.getResourceLinks("Layout", null, null));
            JDFLayout        lo            = (JDFLayout)n.getResourcePool().getPoolChild(0, "Layout", null, null);
            JDFContentObject contentObject = lo.getContentObject(0);

            Assert.IsNotNull(contentObject);
            Assert.AreEqual(new JDFMatrix("1 0 0 1 1 1"), contentObject.getCTM());
            Assert.IsNotNull(lo.getContentObject(1));
        }
Exemple #28
0
        public virtual void testCutAndStack()
        {
            n.setXMLComment("This is a simple cut and stack layout witrh 2 stacks of one page each (two sided)\n");

            setUpAutomatedInputRunList();
            rl.setDescriptiveName("This is any RunList...");
            lo = (JDFLayout)n.appendMatchingResource(ElementName.LAYOUT, EnumProcessUsage.AnyInput, null);
            lo.setResStatus(EnumResStatus.Available, true);
            lo.setMaxOrd(2);
            lo.setAutomated(true);
            lo.setXMLComment("2 stacks with 2 pages\n" + "The algorithm for calculating which pages go where is:\n" + "Ord + MaxOrd*SheetLoop%(MaxOrd*MaxStack*StackDepth) + StackOrd*StackDepth\n" + "Each set of stacks consumes 2 * 2 * 100 = 400 Pages (4 ContentObjects = 2 front, 2 Back / Sheet * 100 StackDepth");
            lo.setAttribute("StackDepth", "100");
            lo.setAttribute("MaxStack", "2");
            JDFLayout        cover      = (JDFLayout)lo.addPartition(EnumPartIDKey.SheetName, "TheSheet");
            JDFLayout        coverFront = (JDFLayout)cover.addPartition(EnumPartIDKey.Side, EnumSide.Front);
            JDFContentObject co         = coverFront.appendContentObject();

            co.setCTM(new JDFMatrix(1, 0, 0, 1, 0, 0));
            co.setOrd(0);
            co.setAttribute("StackOrd", "0");
            co.setDescriptiveName("Front Page 0,2,4...0, Stack 0");
            co.setXMLComment("this co consumes all pages 0,2,4...198, 400,402,404...598, 800....");

            co = coverFront.appendContentObject();
            co.setCTM(new JDFMatrix(1, 0, 0, 1, 8.5 * 72, 0));
            co.setOrd(0);
            co.setAttribute("StackOrd", "1");
            co.setDescriptiveName("Front Page 0,2,4,...0, Stack 1");
            co.setXMLComment("this co consumes all pages 200,202,204...398, 600,602,604...798, 1000....");

            JDFLayout coverBack = (JDFLayout)cover.addPartition(EnumPartIDKey.Side, EnumSide.Back);

            co = coverBack.appendContentObject();
            co.setCTM(new JDFMatrix(1, 0, 0, 1, 8.5 * 72, 0));
            co.setOrd(1);
            co.setAttribute("StackOrd", "0");
            co.setDescriptiveName("Back Page 1,3,5, Stack 0");
            co.setXMLComment("this co consumes all pages 1,3,5...199, 401,403,405...499, 801....");

            co = coverBack.appendContentObject();
            co.setCTM(new JDFMatrix(1, 0, 0, 1, 0, 0));
            co.setOrd(1);
            co.setAttribute("StackOrd", "1");
            co.setDescriptiveName("Back Page 1,3,5, Stack 1");
            co.setXMLComment("this co consumes all pages 201,203,205...299, 601,603,605...799, 1001....");

            doc.write2File(sm_dirTestDataTemp + "CutStack.jdf", 2, false);
        }
Exemple #29
0
        public virtual void testWebGrowthCompensation()
        {
            JDFElement.setLongID(false);
            doc = new JDFDoc("JDF");
            JDFNode         n    = doc.getJDFRoot();
            JDFResourcePool rp   = n.getCreateResourcePool();
            JDFResource     lo   = n.addResource("Layout", EnumResourceClass.Parameter, EnumUsage.Input, null, null, null, null);
            JDFLayout       losh = (JDFLayout)lo.addPartition(EnumPartIDKey.SheetName, "Sheet1");
            JDFLayout       lofr = (JDFLayout)losh.addPartition(EnumPartIDKey.Side, EnumSide.Front.getName());

            rp.appendXMLComment("LayoutShift SHOULD be partitioned: at least Side and Separation will make sense", null);

            JDFResource los = n.addResource("LayoutShift", EnumResourceClass.Parameter, EnumUsage.Input, null, null, null, null);

            los.appendXMLComment("Note that the interpolation algorithm between positions is implementation dependent", null);
            los = los.addPartition(EnumPartIDKey.Side, "Front");
            VString vSep = new VString("Cyan Magenta Yellow Black", " ");

            for (int i = 0; i < 16; i++)
            {
                int x               = 720 * (i % 4);
                int y               = 1000 * (i / 4);
                int ord             = i % 8;
                JDFContentObject co = lofr.appendContentObject();
                co.setOrd(ord);
                co.setOrdID(i);
                co.setCTM(new JDFMatrix(1, 0, 0, 1, x, y));
                JDFMarkObject mo = lofr.appendMarkObject();
                mo.setOrd(ord);
                mo.setOrdID(i + 100);
                mo.setCTM(new JDFMatrix(1, 0, 0, 1, x + 700, y + 900));
            }
            for (int j = 0; j < vSep.Count; j++)
            {
                KElement sepShift = los.addPartition(EnumPartIDKey.Separation, vSep.stringAt(j));
                for (int i = 0; i < 16; i += 2)
                {
                    int      x           = 720 * (i % 4);
                    int      y           = 1000 * (i / 4);
                    KElement shiftObject = sepShift.appendElement("ShiftPoint");

                    shiftObject.setAttribute("Position", new JDFXYPair(x + 360, y + 500).ToString());
                    shiftObject.setAttribute("CTM", new JDFMatrix(1, 0, 0, 1, j + i / 4, j + i % 4).ToString());
                }
            }
            doc.write2File(sm_dirTestDataTemp + "WebgrowthPartition.jdf", 2, false);
        }
Exemple #30
0
        public virtual void testGetLayoutLeavesNew()
        {
            testBuildNewLayout();

            JDFLayout lo     = (JDFLayout)n.getMatchingResource(ElementName.LAYOUT, EnumProcessUsage.AnyInput, null, 0);
            VElement  leaves = lo.getLayoutLeaves(false);

            Assert.AreEqual(6, leaves.Count, "2 Sigs, 2 sheets, 2 surfaces");
            JDFSignature si = lo.getSignature(1);

            leaves = si.getLayoutLeaves(false);
            Assert.AreEqual(4, leaves.Count, "2 sheets, 2 surfaces");
            JDFSheet sh = si.getSheet(2);

            leaves = sh.getLayoutLeaves(false);
            Assert.AreEqual(2, leaves.Count, "2 surfaces");
        }