public virtual void testPlannedWasteICS() { JDFAmountPool ap = rlOut.getCreateAmountPool(); JDFAmountPool apIn = rlMediaIn.getCreateAmountPool(); JDFComponent cover = (JDFComponent)outComp.addPartition(EnumPartIDKey.SheetName, "Cover"); JDFAttributeMap map = cover.getPartMap(); ap.appendXMLComment("Want 10000-10400 good cover sheets and allow for 500 waste cover sheets", null); map.put(EnumPartIDKey.Condition, "Good"); rlOut.setAmount(10000, map); rlOut.setMaxAmount(10400, map); apIn.appendXMLComment("Amount[Good]: planned consumption for good production\n" + "MaxAmount[Good]: planned maximum consumption for good production\n" + "MaxAmount[Waste]: planned Media for waste", null); rlMediaIn.setAmount(10500, map); map.put(EnumPartIDKey.Condition, "Waste"); rlMediaIn.setMaxAmount(500, map); ap.appendXMLComment("Want 20000 good first insert sheets and allow for 200 waste insert sheets", null); JDFComponent sheet1 = (JDFComponent)outComp.addPartition(EnumPartIDKey.SheetName, "Sheet1"); map = sheet1.getPartMap(); map.put(EnumPartIDKey.Condition, "Good"); rlOut.setAmount(20000, map); rlOut.setMaxAmount(20800, map); rlMediaIn.setAmount(21000, map); map.put(EnumPartIDKey.Condition, "Waste"); rlMediaIn.setMaxAmount(200, map); ap.appendXMLComment("Want 20000 good second insert sheets and allow for 100 waste insert sheets", null); JDFComponent sheet2 = (JDFComponent)outComp.addPartition(EnumPartIDKey.SheetName, "Sheet2"); map = sheet2.getPartMap(); map.put(EnumPartIDKey.Condition, "Good"); rlOut.setAmount(20000, map); rlOut.setMaxAmount(20800, map); rlMediaIn.setAmount(20900, map); map.put(EnumPartIDKey.Condition, "Waste"); rlMediaIn.setMaxAmount(100, map); d.write2File(sm_dirTestDataTemp + "plannedWasteICS.jdf", 2, true); // // * map=cover.getPartMap(); map.put(EnumPartIDKey.Condition, "Good"); // * rl.getAmountPool().getPartAmount(map,0).appendXMLComment( // * "Actually produced covers: 10200\nWaste put on output stack:100"); // * rlIn.getAmountPool().getPartAmount(map,0).appendXMLComment( // * "Total consumed sheets: 10400\nOf that: sheets wasted: 200"); // * rl.setActualAmount(10200, map); rlIn.setActualAmount(10200, map); // * map.put(EnumPartIDKey.Condition, "Waste"); rl.setActualAmount(100, // * map); rlIn.setActualAmount(200, map); // * // * d.write2File(sm_dirTestDataTemp+"actualWasteICS.jdf", 2, true); // }
public virtual void testContentDataFinishing() { testContentData(); JDFComponent c = (JDFComponent)n.addResource(ElementName.COMPONENT, EnumUsage.Output); JDFComponent c1 = (JDFComponent)c.addPartition(EnumPartIDKey.BlockName, "Stack1"); JDFComponent c2 = (JDFComponent)c.addPartition(EnumPartIDKey.BlockName, "Stack2"); c.refElement(pl); c1.setPageListIndex(new JDFIntegerRangeList("0~8")); c2.setPageListIndex(new JDFIntegerRangeList("9~16")); c.setXMLComment("this is the output component with two stacks\n the imposition engine is aware of the pagelist index and can set it appropriately"); d.write2File(sm_dirTestDataTemp + "ContentMetaDataStack.jdf", 2, false); }
public virtual void testIsPresentPartition() { JDFAction act = devicecap.appendActionPool().appendActionTest(EnumTerm.IsPresentEvaluation, true); JDFTest tst = act.getTest(); tst.setContext("//Component"); JDFIsPresentEvaluation ipe = (JDFIsPresentEvaluation)tst.getTerm(); ipe.setRefTarget(ptState); Assert.AreEqual(ptState.getID(), ipe.getrRef()); JDFDoc doc = new JDFDoc("JDF"); JDFNode node = doc.getJDFRoot(); node.setType("fnarf", false); JDFComponent comp = (JDFComponent)node.addResource("Component", null, EnumUsage.Input, null, null, null, null); comp.setProductType("Cover"); XMLDoc rep = new XMLDoc("root", null); KElement eRep = rep.getRoot(); bool fitsJDF = tst.fitsJDF(comp, eRep); Assert.IsTrue(fitsJDF); comp = (JDFComponent)comp.addPartition(EnumPartIDKey.SheetName, "s1"); fitsJDF = tst.fitsJDF(comp, eRep); Assert.IsTrue(fitsJDF, "also partition leaves "); }
public virtual void testPartAmountVirtual() { JDFDoc d = new JDFDoc(ElementName.JDF); JDFNode n = d.getJDFRoot(); n.setVersion(JDFElement.EnumVersion.Version_1_3); n.setType("ConventionalPrinting", true); JDFComponent comp = (JDFComponent)n.appendMatchingResource(ElementName.COMPONENT, EnumProcessUsage.AnyOutput, null); JDFResourceLink cpLink = n.getLink(comp, null); JDFAttributeMap mapBad = new JDFAttributeMap("Condition", "Waste"); cpLink.setActualAmount(42, mapBad); Assert.AreEqual(42.0, cpLink.getActualAmount(mapBad), 0); Assert.IsTrue(n.isValid(EnumValidationLevel.Incomplete), "allow part amounts to non-existing partitions"); cpLink.removeChild(ElementName.AMOUNTPOOL, null, 0); comp.addPartition(EnumPartIDKey.SheetName, "Sheet1"); mapBad.put(EnumPartIDKey.SheetName.getName(), "Sheet1"); cpLink.setActualAmount(42, mapBad); Assert.AreEqual(42.0, cpLink.getActualAmount(mapBad), 0); Assert.IsTrue(n.isValid(EnumValidationLevel.Incomplete), "allow partamounts to non-existing partitions"); mapBad.put(EnumPartIDKey.SheetName.getName(), "Sheet2"); Assert.AreEqual(0.0, cpLink.getActualAmount(mapBad), 0); JDFAttributeMap m2 = new JDFAttributeMap("Condition", "Waste"); Assert.AreEqual(42.0, cpLink.getActualAmount(m2), 0); m2.put("SheetName", "Sheet1"); Assert.AreEqual(42.0, cpLink.getActualAmount(m2), 0); m2.put("Side", "Front"); Assert.AreEqual(0.0, cpLink.getActualAmount(m2), 0); }
public virtual void testAmountPalletteCompleteManifest() { JDFElement.setLongID(false); JDFDoc d = new JDFDoc("JDF"); JDFNode n = d.getJDFRoot(); n.setType(EnumType.ProcessGroup); n.setTypes(new VString("Binding Stacking BoxPacking Palletizing", " ")); JDFComponent comp = (JDFComponent)n.addResource(ElementName.COMPONENT, null, EnumUsage.Output, null, null, null, null); JDFResourceLink rl = n.getLink(comp, null); rl.setAmount(2, null); rl.setDescriptiveName("The link point to 2 pallets with a total comtent of 10000 brochures in 200 boxes"); JDFComponent compBrochure = (JDFComponent)n.addResource(ElementName.COMPONENT, null, EnumUsage.Input, null, null, null, null); compBrochure.setResStatus(EnumResStatus.Available, true); compBrochure.setDescriptiveName("The individual Brochures"); JDFResourceLink rlB = n.getLink(compBrochure, null); rlB.setAmount(10000, null); rlB.setActualAmount(9700, null); for (int i = 0; i < 2; i++) { // create a pallet partition - may also use the root JDFComponent compPallet = (JDFComponent)comp.addPartition(EnumPartIDKey.DeliveryUnit0, "Pallet" + i); compPallet.setProductID("Pallet_" + i); JDFBundle bundlePallet = compPallet.getCreateBundle(); int nBox = i == 0 ? 100 : 94; bundlePallet.setDescriptiveName("Pallet Bundle describing " + nBox + " boxes with " + nBox * 50 + " Brochures Contents total"); bundlePallet.setTotalAmount(nBox * 50); bundlePallet.setBundleType(EnumBundleType.Pallet); for (int j = 0; j < nBox; j++) { JDFBundleItem biBoxes = bundlePallet.appendBundleItem(); JDFComponent compBox = (JDFComponent)compPallet.addPartition(EnumPartIDKey.DeliveryUnit1, "Box_" + i + "_" + j); compBox.setProductID("Box_" + i + "_" + j); biBoxes.refElement(compBox); biBoxes.setAmount(1); JDFBundle bundleBox = compBox.appendBundle(); bundleBox.setDescriptiveName("Bundle describing box #" + j + " with 50 Brochures Contents per box"); bundleBox.setTotalAmount(50); bundleBox.setBundleType(EnumBundleType.Box); JDFBundleItem biBrochures = bundleBox.appendBundleItem(); biBrochures.refElement(compBrochure); biBrochures.setAmount(50); } } d.write2File(sm_dirTestDataTemp + "MISFinAmountCompleteManifest.jdf", 2, false); }
public virtual void testPlannedWaste() { JDFElement.setLongID(false); d = new JDFDoc("JDF"); n = d.getJDFRoot(); n.setType(EnumType.ConventionalPrinting); outComp = (JDFComponent)n.addResource(ElementName.COMPONENT, null, EnumUsage.Output, null, null, null, null); rlOut = n.getLink(outComp, null); JDFAmountPool ap = rlOut.getCreateAmountPool(); JDFComponent cover = (JDFComponent)outComp.addPartition(EnumPartIDKey.SheetName, "Cover"); JDFAttributeMap map = cover.getPartMap(); ap.appendXMLComment("Want 10000-10500 good cover sheets and allow for 500 waste cover sheets", null); map.put(EnumPartIDKey.Condition, "Good"); rlOut.setAmount(10000, map); rlOut.setMaxAmount(10500, map); map.put(EnumPartIDKey.Condition, "Waste"); rlOut.setMaxAmount(500, map); ap.appendXMLComment("Want 20000 good first insert sheets and allow for 200 waste insert sheets", null); JDFComponent sheet1 = (JDFComponent)outComp.addPartition(EnumPartIDKey.SheetName, "Sheet1"); map = sheet1.getPartMap(); map.put(EnumPartIDKey.Condition, "Good"); rlOut.setAmount(20000, map); map.put(EnumPartIDKey.Condition, "Waste"); rlOut.setMaxAmount(200, map); ap.appendXMLComment("Want 20000 good second insert sheets and allow for 200 waste insert sheets", null); JDFComponent sheet2 = (JDFComponent)outComp.addPartition(EnumPartIDKey.SheetName, "Sheet2"); map = sheet2.getPartMap(); map.put(EnumPartIDKey.Condition, "Good"); rlOut.setAmount(20000, map); map.put(EnumPartIDKey.Condition, "Waste"); rlOut.setMaxAmount(100, map); d.write2File(sm_dirTestDataTemp + "plannedWaste.jdf", 2, true); }
public virtual void testAmount() { JDFElement.setLongID(false); JDFDoc d = new JDFDoc("JDF"); JDFNode n = d.getJDFRoot(); n.setType(EnumType.ProcessGroup); n.setTypes(new VString("Binding Stacking BoxPacking Palletizing", " ")); JDFComponent comp = (JDFComponent)n.addResource(ElementName.COMPONENT, null, EnumUsage.Output, null, null, null, null); JDFResourceLink rl = n.getLink(comp, null); rl.setAmount(2, null); rl.setDescriptiveName("The link point to 2 pallets with a total comtent of 10000 brochures in 200 boxes"); // create a pallet partition - may also use the root JDFComponent compPallet = (JDFComponent)comp.addPartition(EnumPartIDKey.DeliveryUnit0, "Pallet"); JDFComponent compBox = (JDFComponent)compPallet.addPartition(EnumPartIDKey.DeliveryUnit1, "Box"); JDFBundle bundlePallet = compPallet.appendBundle(); bundlePallet.setDescriptiveName("Bundle describing 100 boxes with 5000 Brochures Contents total"); bundlePallet.setTotalAmount(5000); bundlePallet.setBundleType(EnumBundleType.Pallet); JDFBundleItem biBoxes = bundlePallet.appendBundleItem(); biBoxes.refElement(compBox); biBoxes.setAmount(100); JDFComponent compBrochure = (JDFComponent)compBox.addPartition(EnumPartIDKey.DeliveryUnit2, "Brochure"); JDFBundle bundleBox = compBox.appendBundle(); bundleBox.setDescriptiveName("Bundle describing 1 boxes with 50 Brochures Contents per box"); bundleBox.setTotalAmount(50); bundleBox.setBundleType(EnumBundleType.Box); JDFBundleItem biBrochures = bundleBox.appendBundleItem(); biBrochures.refElement(compBrochure); biBrochures.setAmount(50); JDFBundle bundleBrochure = compBrochure.appendBundle(); bundleBrochure.setDescriptiveName("Dummy Bundle to inhibit inheritence of the box Bundle"); d.write2File(sm_dirTestDataTemp + "MISFinAmount.jdf", 2, false); }
public virtual void testVariableManifests() { ruli.setXMLComment("the set / doc / ... structure is transferred from the pre-impositioning pdl"); JDFPageList pl = (JDFPageList)n.addResource(ElementName.PAGELIST, null); pl.setResStatus(EnumResStatus.Available, false); JDFContentList cl = (JDFContentList)pl.appendContentList().makeRootResource(null, null, true); cl.setResStatus(EnumResStatus.Available, false); cl.setXMLComment("Should we allow for content-data cross references to forther contentdata fields?"); ruli.refPageList(pl); comp.refPageList(pl); int pageCount = 0; digiParams.setSides(EnumSides.TwoSidedFlipY); digiParams.setXMLComment("the sides attribute may be overridden by explicitly or implicitly missing runlist input elements"); VString vRun = new VString("Letter BrochureMale BrochureFemale", null); JDFStitchingParams sp = (JDFStitchingParams)n.addResource(ElementName.STITCHINGPARAMS, EnumUsage.Input); med.setXMLComment("Media Partitioning is convenience only- the actual media selection is done by the digitalprintingparams MediaRef"); for (int i = 0; i < vRun.Count; i++) { string part = vRun[i]; JDFMedia partMedia = (JDFMedia)med.addPartition(EnumPartIDKey.Run, part); partMedia.setProductID(part + "Media"); JDFDigitalPrintingParams digiPart = (JDFDigitalPrintingParams)digiParams.addPartition(EnumPartIDKey.Run, part); digiPart.refMedia(partMedia); sp.setXMLComment("how are multiple runs stitched together e.g. cover + body?"); JDFStitchingParams spPart = (JDFStitchingParams)sp.addPartition(EnumPartIDKey.Run, part); if (i == 0) { spPart.setNoOp(true); spPart.setDescriptiveName("The letter is a loose leaf collection"); } else { spPart.setNumberOfStitches(3); spPart.setStitchType(EnumStitchType.Saddle); } } // loop over records for (int i = 0; i < 10; i++) { JDFContentData letter = cl.appendContentData(); letter.setContentType("Letter"); JDFContentData brochure = cl.appendContentData(); brochure.setContentType("Brochure"); KElement lMeta = letter.appendElement("ContentMetadata"); // TODO apply new example lMeta.setAttribute("Record", "" + i); string gender = i % 2 == 0 ? "Male" : "Female"; lMeta.setAttribute("Gender", gender); lMeta.setXMLComment("Note that the final format of the metadata element is open"); KElement bMeta = brochure.appendElement("Metadata"); bMeta.setAttribute("Record", "" + i); bMeta.setAttribute("Gender", gender); JDFRunList runSet = (JDFRunList)ruli.addPartition(EnumPartIDKey.RunSet, "Record" + i); JDFRunList run = runSet.addRun("file://server/tifs/testLetter" + i + ".tif", 0, -1); run.setRun("Letter"); JDFComponent compSet = (JDFComponent)comp.addPartition(EnumPartIDKey.RunSet, runSet.getRunSet()); JDFComponent co = (JDFComponent)compSet.addPartition(EnumPartIDKey.Run, run.getRun()); int page = (3 * i) % 7 + 1; run.setPageListIndex(new JDFIntegerRangeList(new JDFIntegerRange(pageCount, pageCount + page - 1))); co.setPageListIndex(new JDFIntegerRangeList(new JDFIntegerRange(pageCount, pageCount + page - 1))); co.setSurfaceCount(2 * ((page + 1) / 2)); run.setPages(new JDFIntegerRangeList("0~" + (page - 1))); run.setXMLComment("Cover Letter - record " + i); run.setEndOfDocument(true); JDFPageData pd = pl.appendPageData(); pd.refContentData(letter); pd.setAttribute("PageIndex", pageCount + " ~ " + (pageCount + page - 1)); pageCount += page; run = runSet.addRun("file://server/tifs/testBrochure" + i + ".tif", 0, -1); run.setRun("Brochure" + gender); co = (JDFComponent)compSet.addPartition(EnumPartIDKey.Run, run.getRun()); page = 2 * ((7 * i) % 13) + 2; run.setPageListIndex(new JDFIntegerRangeList(new JDFIntegerRange(pageCount, pageCount + page - 1))); co.setPageListIndex(new JDFIntegerRangeList(new JDFIntegerRange(pageCount, pageCount + page - 1))); co.setSurfaceCount(2 * ((page + 1 + 1) / 2)); // the 2nd +1 is for // the blank inside // cover run.setPages(new JDFIntegerRangeList("0~" + (page - 1))); run.setXMLComment("Brochure - record " + i); run.setEndOfDocument(true); runSet.setEndOfSet(true); run.setAttribute("SkipBlankOrds", "1"); run.setNPage(page + 1); run.setXMLComment("SkipBlankOrds specifies the relative position of pages to skip\n1 specifies that the first back sheet is skipped\nNPage MUST be incremented by the # of skipped pages."); pd = pl.appendPageData(); pd.refContentData(brochure); pd.setAttribute("PageIndex", pageCount + " ~ " + (pageCount + page - 1)); pageCount += page; } doc.write2File(sm_dirTestDataTemp + "RunlistManifest.jdf", 2, false); }
public virtual void testTaggedAutomatedBooklet() { n.setXMLComment("This is a simple Automated Booklet using negative ords and meta data tags\n" + "New Attribute @OrdsConsumed limits the number of ords consumed by an automated Layout\n" + "Negative Ord values are assumed to flow backwards\n" + "New Attribute @OrdReset defines the scope of ords\n" + "MaxOrd is not specified and must be calculated by counting the number of different ord values\n" + "If we want to keep maxord, it would have to be replaced by an xypair that specifies hom many are consumed from back and from front\n" + "If the number of pages is not mod 4, blank pages are retained at the back of the layout"); n.setType(EnumType.Combined); n.setTypes(new VString("Interpreting Rendering DigitalPrinting Inserting Stitching", null)); setUpAutomatedInputRunList(); rl.setDescriptiveName("This is any RunList..."); lo = (JDFLayout)n.appendMatchingResource(ElementName.LAYOUT, EnumProcessUsage.AnyInput, null); lo.setResStatus(EnumResStatus.Available, true); JDFMedia media = (JDFMedia)n.addResource("Media", EnumUsage.Input); JDFMedia mediaC = (JDFMedia)media.addPartition(EnumPartIDKey.SheetName, "TheCover"); JDFMedia mediaCMale = (JDFMedia)mediaC.addPartition(EnumPartIDKey.SetTags, "Male"); JDFMedia mediaCFemale = (JDFMedia)mediaC.addPartition(EnumPartIDKey.SetTags, "Female"); JDFComponent insert = (JDFComponent)n.addResource("Component", null, EnumUsage.Input, EnumProcessUsage.Child, null, null, null); // JDFComponent insertExist=(JDFComponent) insert.addPartition(EnumPartIDKey.DocTags, "Exist"); // JDFComponent insertProspect=(JDFComponent) insert.addPartition(EnumPartIDKey.DocTags, "Prospect"); JDFLayout cover = (JDFLayout)lo.addPartition(EnumPartIDKey.SheetName, "TheCover"); cover.setAutomated(false); JDFLayout coverMale = (JDFLayout)cover.addPartition(EnumPartIDKey.SetTags, "Male"); coverMale.refMedia(mediaCMale); JDFLayout coverMaleHi = (JDFLayout)coverMale.addPartition(EnumPartIDKey.PageTags, "Hi"); JDFLayout coverMaleLo = (JDFLayout)coverMale.addPartition(EnumPartIDKey.PageTags, "Low"); JDFLayout coverFemale = (JDFLayout)cover.addPartition(EnumPartIDKey.SetTags, "Female"); coverFemale.refMedia(mediaCFemale); JDFLayout coverFemaleHi = (JDFLayout)coverFemale.addPartition(EnumPartIDKey.PageTags, "Hi"); JDFLayout coverFemaleLo = (JDFLayout)coverFemale.addPartition(EnumPartIDKey.PageTags, "Low"); JDFLayout[] lo4 = new JDFLayout[4]; lo4[0] = coverMaleHi; lo4[1] = coverFemaleHi; lo4[2] = coverMaleLo; lo4[3] = coverFemaleLo; JDFContentObject co; for (int i = 0; i < 4; i++) { JDFLayout lolo = lo4[i]; JDFLayout coverFront = (JDFLayout)lolo.addPartition(EnumPartIDKey.Side, "Front"); co = coverFront.appendContentObject(); co.setCTM(new JDFMatrix(1, 0, 0, 1, 0, 0)); co.setOrd(0); co.setDescriptiveName("Front Cover Page Outside"); co = coverFront.appendContentObject(); co.setCTM(new JDFMatrix(1, 0, 0, 8.5 * 72, 0, 0)); co.setOrd(-1); co.setDescriptiveName("Back Cover Page Outside"); if (i < 2) { JDFLayout coverBack = (JDFLayout)lolo.addPartition(EnumPartIDKey.Side, "Back"); co = coverBack.appendContentObject(); co.setCTM(new JDFMatrix(1, 0, 0, 1, 0, 0)); co.setOrd(0); co.setDescriptiveName("Front Cover Page Inside"); co = coverBack.appendContentObject(); co.setCTM(new JDFMatrix(1, 0, 0, 8.5 * 72, 0, 0)); co.setOrd(-1); co.setDescriptiveName("Back Cover Page Inside"); } } JDFLayout sheet = (JDFLayout)lo.addPartition(EnumPartIDKey.SheetName, "TheSheet"); sheet.setAutomated(true); sheet.setAttribute("OrdReset", "Set Doc"); sheet.setAttribute("OrdsConsumed", "0 -1"); sheet = (JDFLayout)sheet.addPartition(EnumPartIDKey.SetTags, "Male Female").addPartition(EnumPartIDKey.PageTags, "Hi Lo"); JDFLayout sheetFront = (JDFLayout)sheet.addPartition(EnumPartIDKey.Side, EnumSide.Front); co = sheetFront.appendContentObject(); co.setCTM(new JDFMatrix(1, 0, 0, 1, 0, 0)); co.setOrd(0); co.setDescriptiveName("Front left Page 0,2,4..."); co = sheetFront.appendContentObject(); co.setCTM(new JDFMatrix(1, 0, 0, 1, 8.5 * 72, 0)); co.setOrd(-1); co.setDescriptiveName("Back right page after folding -1 -3 -5 ... (Front sheet)"); JDFLayout sheetBack = (JDFLayout)sheet.addPartition(EnumPartIDKey.Side, EnumSide.Back); co = sheetBack.appendContentObject(); co.setCTM(new JDFMatrix(1, 0, 0, 1, 8.5 * 72, 0)); co.setOrd(1); co.setDescriptiveName("Back left Page 1,3,5"); co = sheetBack.appendContentObject(); co.setCTM(new JDFMatrix(1, 0, 0, 1, 0, 0)); co.setOrd(-2); co.setDescriptiveName("Front Right Page Page -2 -4 -6"); string s = doc.write2String(2); s = StringUtil.replaceString(s, "SetTags", "Meta0"); s = StringUtil.replaceString(s, "DocTags", "Meta1"); s = StringUtil.replaceString(s, "PageTags", "Meta2"); FileInfo f = new FileInfo(sm_dirTestDataTemp + "TaggedAutomatedBooklet.jdf"); Stream os = new FileStream(f.FullName, FileMode.Append); byte[] ba = Encoding.ASCII.GetBytes(s); os.Write(ba, 0, ba.Length); }