public virtual void testGetPartAmountMulti() { JDFDoc d = new JDFDoc("JDF"); JDFNode n = d.getJDFRoot(); n.setType(EnumType.ConventionalPrinting); JDFComponent comp = (JDFComponent)n.addResource("Component", null, EnumUsage.Output, null, null, null, null); JDFAttributeMap map = new JDFAttributeMap(EnumPartIDKey.SignatureName, "Sig1"); JDFAttributeMap mapSig = new JDFAttributeMap(map); JDFAttributeMap map2 = new JDFAttributeMap(EnumPartIDKey.SignatureName, "Sig1"); JDFResourceLink rl = n.getLink(comp, null); map.put(EnumPartIDKey.SheetName, "Sheet"); comp.getCreatePartition(map, new VString("SignatureName SheetName", " ")); map.put(EnumPartIDKey.Side, "Front"); map2.put(EnumPartIDKey.Side, "Back"); VJDFAttributeMap vMap = new VJDFAttributeMap(); vMap.Add(map); vMap.Add(map2); JDFAmountPool aplocal = rl.appendAmountPool(); JDFPartAmount pa = aplocal.appendPartAmount(vMap); Assert.AreEqual(pa.numChildElements_JDFElement(ElementName.PART, null), 2); rl.setActualAmount(42, map); rl.setActualAmount(21, map2); Assert.AreEqual(2, pa.numChildElements_JDFElement(ElementName.PART, null)); Assert.AreEqual(42.0, rl.getActualAmount(map), 0.0); Assert.AreEqual(42.0 + 21.0, rl.getActualAmount(mapSig), 0.0); Assert.AreEqual(aplocal.getPartAmount(vMap), pa); }
public virtual void testVirtualAmounts() { JDFDoc d = new JDFDoc("JDF"); JDFNode n = d.getJDFRoot(); n.setType(EnumType.ConventionalPrinting); JDFComponent comp = (JDFComponent)n.addResource("Component", null, EnumUsage.Output, null, null, null, null); JDFAttributeMap map = new JDFAttributeMap(EnumPartIDKey.SignatureName, "Sig1"); JDFResourceLink rl = n.getLink(comp, null); for (int i = 0; i < 5; i++) { map.put(EnumPartIDKey.SheetName, "Sheet" + i); comp.getCreatePartition(map, new VString("SignatureName SheetName", " ")); rl.setAmount(500 + i, map); JDFAttributeMap map2 = new JDFAttributeMap(map); map2.put("Condition", "Good"); rl.setActualAmount(500 + i, map2); map2.put("Condition", "Waste"); rl.setActualAmount(50 + i, map2); map2.put("Condition", "Good"); Assert.AreEqual(500 + i, rl.getActualAmount(map2), 0.01); map2.put("Condition", "Waste"); Assert.AreEqual(50 + i, rl.getActualAmount(map2), 0.01); } }
public virtual void testReducePartAmounts() { JDFDoc d = new JDFDoc("JDF"); JDFNode n = d.getJDFRoot(); n.setType(EnumType.ConventionalPrinting); JDFComponent comp = (JDFComponent)n.addResource("Component", null, EnumUsage.Output, null, null, null, null); JDFAttributeMap map = new JDFAttributeMap(EnumPartIDKey.SignatureName, "Sig1"); JDFResourceLink rl = n.getLink(comp, null); for (int i = 0; i < 5; i++) { map.put(EnumPartIDKey.SheetName, "Sheet" + i); comp.getCreatePartition(map, new VString("SignatureName SheetName", " ")); rl.setAmount(500 + i, map); JDFAttributeMap map2 = new JDFAttributeMap(map); map2.put("Condition", "Good"); rl.setActualAmount(500 + i, map2); map2.put("Condition", "Waste"); rl.setActualAmount(50 + i, map2); } VJDFAttributeMap v = new VJDFAttributeMap(); JDFAttributeMap testMap = new JDFAttributeMap(EnumPartIDKey.Condition, "Good"); v.Add(testMap); JDFAmountPool aplocal = rl.getAmountPool(); Assert.AreEqual(15, aplocal.numChildElements(ElementName.PARTAMOUNT, null), "15 pa entries"); aplocal.reducePartAmounts(v); Assert.AreEqual(5, aplocal.numChildElements(ElementName.PARTAMOUNT, null), "5 pa entries"); testMap.put("SheetName", "Sheet3"); aplocal.reducePartAmounts(v); Assert.AreEqual(1, aplocal.numChildElements(ElementName.PARTAMOUNT, null), "1 pa entries"); }
/// /// * <param name="icsLevel"> </param> /// protected internal virtual JDFComponent initOutputComponent() { if (thePreviousNode != null) { JDFResource parentOutComp = thePreviousNode.getResource(ElementName.COMPONENT, EnumUsage.Output, 0); if (parentOutComp != null) { theNode.linkResource(parentOutComp, EnumUsage.Input, null); } } JDFComponent outComp = (JDFComponent)(theParentNode != null ? theParentNode.getResource(ElementName.COMPONENT, EnumUsage.Output, 0) : null); if (outComp == null) { outComp = (JDFComponent)theNode.getCreateResource(ElementName.COMPONENT, EnumUsage.Output, 0); outComp.setComponentType(EnumComponentType.FinalProduct, EnumComponentType.Sheet); outComp.setProductType("Unknown"); } else { theNode.linkResource(outComp, EnumUsage.Output, null); } JDFResourceLink rl = theNode.getLink(outComp, EnumUsage.Output); if (vParts != null) { VJDFAttributeMap reducedMap = getReducedMap(new VString("Side Separation", " ")); if (reducedMap != null) { int size = reducedMap.Count; for (int i = 0; i < size; i++) { JDFAttributeMap part = reducedMap[i]; JDFResource partComp = outComp.getCreatePartition(part, partIDKeys); partComp.setDescriptiveName("Description for Component part# " + i); JDFAttributeMap newMap = new JDFAttributeMap(part); newMap.put(AttributeName.CONDITION, "Good"); rl.setAmount(good, newMap); } } } else { outComp.setDescriptiveName("MIS-CP output Component"); } // outComp.getCreateLayout(); JDFMedia inMedia = (JDFMedia)theNode.getResource(ElementName.MEDIA, EnumUsage.Input, 0); if (inMedia != null) { outComp.setDimensions(inMedia.getDimension()); } return(outComp); }
protected internal static JDFDoc creatXMDoc() { JDFElement.setDefaultJDFVersion(EnumVersion.Version_1_3); JDFDoc doc = new JDFDoc("JDF"); JDFNode n = doc.getJDFRoot(); n.setJobPartID("P1"); n.setJobID("J1"); n.setType("ConventionalPrinting", true); n.appendElement("NS:Foobar", "www.foobar.com"); n.appendMatchingResource("Layout", JDFNode.EnumProcessUsage.AnyInput, null); JDFComponent comp = (JDFComponent)n.appendMatchingResource("Component", JDFNode.EnumProcessUsage.AnyOutput, null); JDFExposedMedia xm = (JDFExposedMedia)n.appendMatchingResource("ExposedMedia", JDFNode.EnumProcessUsage.Plate, null); JDFNodeInfo ni = n.appendNodeInfo(); JDFMedia m = xm.appendMedia(); m.appendElement("NS:FoobarMedia", "www.foobar.com"); Assert.AreEqual(EnumResourceClass.Consumable, m.getResourceClass(), "m Class"); VString vs = new VString(); vs.Add("SignatureName"); vs.Add("SheetName"); vs.Add("Side"); JDFAttributeMap mPart1 = new JDFAttributeMap("SignatureName", "Sig1"); mPart1.put("SheetName", "S1"); mPart1.put("Side", "Front"); xm.getCreatePartition(mPart1, vs); ni.getCreatePartition(mPart1, vs); comp.getCreatePartition(mPart1, vs); mPart1.put("Side", "Back"); xm.getCreatePartition(mPart1, vs); ni.getCreatePartition(mPart1, vs); comp.getCreatePartition(mPart1, vs); mPart1.put("SheetName", "S2"); mPart1.put("Side", "Front"); xm.getCreatePartition(mPart1, vs); ni.getCreatePartition(mPart1, vs); comp.getCreatePartition(mPart1, vs); mPart1.put("Side", "Back"); xm.getCreatePartition(mPart1, vs); ni.getCreatePartition(mPart1, vs); comp.getCreatePartition(mPart1, vs); mPart1.put("SignatureName", "Sig2"); mPart1.put("SheetName", "S1"); mPart1.put("Side", "Front"); xm.getCreatePartition(mPart1, vs); ni.getCreatePartition(mPart1, vs); comp.getCreatePartition(mPart1, vs); comp.appendElement("foo:bar", "www.foobar.com"); mPart1.put("Side", "Back"); xm.getCreatePartition(mPart1, vs); ni.getCreatePartition(mPart1, vs); comp.getCreatePartition(mPart1, vs); mPart1.put("SheetName", "S2"); mPart1.put("Side", "Front"); xm.getCreatePartition(mPart1, vs); ni.getCreatePartition(mPart1, vs); comp.getCreatePartition(mPart1, vs); mPart1.put("Side", "Back"); xm.getCreatePartition(mPart1, vs); ni.getCreatePartition(mPart1, vs); comp.getCreatePartition(mPart1, vs); return(doc); }