public virtual void testCombinedVarnish() { JDFElement.setLongID(false); JDFDoc d = new JDFDoc("JDF"); JDFNode n = d.getJDFRoot(); VString vCombiNodes = new VString("ConventionalPrinting Varnishing", " "); VString vSeparations = new VString("Cyan Magenta Yellow Black Varnish", " "); n.setCombined(vCombiNodes); JDFConventionalPrintingParams cpp = (JDFConventionalPrintingParams)n.addResource(ElementName.CONVENTIONALPRINTINGPARAMS, null, EnumUsage.Input, null, null, null, null); cpp.setModuleAvailableIndex(new JDFIntegerRangeList("1 ~ 6")); cpp.setModuleIndex(new JDFIntegerRangeList("1 ~ 4 6")); cpp.appendXMLComment("Module 0 and 7 are varnishing modules, 1-4 are process colors and 6 is the ink module used to varnish", null); n.appendMatchingResource("Component", JDFNode.EnumProcessUsage.AnyOutput, null); JDFExposedMedia xm = (JDFExposedMedia)n.appendMatchingResource("ExposedMedia", JDFNode.EnumProcessUsage.Plate, null); n.appendNodeInfo(); JDFMedia media = xm.appendMedia(); media.setMediaType(EnumMediaType.Plate); JDFInk ink = (JDFInk)n.appendMatchingResource("Ink", JDFNode.EnumProcessUsage.AnyInput, null); JDFResource vp = n.addResource("VarnishingParams", EnumResourceClass.Parameter, EnumUsage.Input, null, null, null, null); JDFExposedMedia xmVarnish = (JDFExposedMedia)n.addResource("ExposedMedia", null, EnumUsage.Input, null, null, null, null); JDFMedia mediaVarnish = xmVarnish.appendMedia(); mediaVarnish.setAttribute("MediaType", "Sleeve"); JDFResourceLink rl = n.getLink(xmVarnish, null); JDFColorantControl cc = (JDFColorantControl)n.appendMatchingResource(ElementName.COLORANTCONTROL, JDFNode.EnumProcessUsage.AnyInput, null); cc.getCreateDeviceColorantOrder().appendXMLComment("Should the VarnishingParams seps be excluded, as is shown here?", null); cc.getCreateDeviceColorantOrder().setSeparations(vSeparations); rl.setCombinedProcessIndex(new JDFIntegerList("1")); vSeparations.addAll(new VString("PreVarnish Varnish2", " ")); for (int i = 0; i < vSeparations.Count; i++) { string sep = vSeparations.stringAt(i); ink.addPartition(EnumPartIDKey.Separation, sep); if (!sep.Equals("PreVarnish") && !sep.Equals("Varnish2")) { xm.addPartition(EnumPartIDKey.Separation, sep); } if (sep.Equals("Varnish2")) { vp.appendXMLComment("full varnishing in a varnishing module with or wihtout a sleeve. Full varnishing means to cover the complete media surface.", null); xmVarnish.addPartition(EnumPartIDKey.Separation, sep); JDFResource varnishPart = vp.addPartition(EnumPartIDKey.Separation, sep); varnishPart.setAttribute("ModuleIndex", "7"); varnishPart.setAttribute("VarnishMethod", "Sleeve"); varnishPart.setAttribute("VarnishArea", "Spot"); } else if (sep.Equals("Varnish")) { vp.appendXMLComment("varnishing in a printing module only with a mandatory plate. The plate may be exposed or not, for example, for full varnihing. ", null); // xmVarnish.addPartition(EnumPartIDKey.Separation, sep); JDFResource varnishPart = vp.addPartition(EnumPartIDKey.Separation, sep); varnishPart.setAttribute("ModuleIndex", "6"); varnishPart.setAttribute("VarnishMethod", "Plate"); varnishPart.setAttribute("VarnishArea", "Full"); } else if (sep.Equals("PreVarnish")) { vp.appendXMLComment("varnishing in a varnishing module only with a mandatory prepared sleeve ", null); xmVarnish.addPartition(EnumPartIDKey.Separation, sep); JDFResource varnishPart = vp.addPartition(EnumPartIDKey.Separation, sep); varnishPart.setAttribute("ModuleIndex", "0"); varnishPart.setAttribute("VarnishMethod", "Sleeve"); varnishPart.setAttribute("VarnishArea", "Full"); } } d.write2File(sm_dirTestDataTemp + "varnishing.jdf", 2, true); }
/// /// <summary> * append elements to the node that match this DevCap, if they do not exist /// * yet /// * </summary> /// * <param name="node"> /// * the node to append the elements to </param> /// * <param name="bAll"> /// * if false, only add if minOccurs>=1 and required=true or a /// * default exists /// * </param> /// * <returns> KElement - the last element that was appended </returns> /// public virtual KElement appendMatchingElementsToNode(JDFNode node, bool bAll, org.cip4.jdflib.util.VectorMap <int, JDFResource> indexResMap, bool bLink) { KElement e = null; EnumContext context = getContext(); if (!bLink && EnumContext.Link.Equals(context)) { return(null); } if (bLink && !EnumContext.Link.Equals(context)) { return(null); } JDFDevCap devCap = getDevCap(); if (devCap == null) { return(null); } int minOcc = devCap.getMinOccurs(); if (minOcc == 0 && bAll) { minOcc = 1; } string nam = getName(); for (int i = 0; i < minOcc; i++) { if (context.Equals(EnumContext.Element)) { // vElem - for a common return type in all cases if (nam.Equals(ElementName.JDF)) { // nop - should actually never get here } else { e = node.getCreateElement(nam, getDevNS(), i); } } else if (context.Equals(EnumContext.Resource) || context.Equals(EnumContext.Link)) { EnumUsage linkUsage = getLinkUsage(); string procUsage = getProcessUsage(); JDFAttributeMap map = new JDFAttributeMap(); EnumProcessUsage pu = null; if (procUsage != null && procUsage.Length > 0) { map.put(AttributeName.PROCESSUSAGE, procUsage); pu = EnumProcessUsage.getEnum(procUsage); } if (linkUsage != null) { map.put(AttributeName.USAGE, linkUsage.getName()); } VElement links = node.getResourceLinks(nam, map, null); // now look for the correct combinedprocessindex - remove all // non-matching JDFIntegerRangeList tocNum = getTypeOccurrenceNum(); JDFIntegerList tocNum2 = tocNum == null ? null : tocNum.getIntegerList(); if (links != null && tocNum != null) { for (int ll = links.Count - 1; ll >= 0; ll--) { JDFResourceLink rl = (JDFResourceLink)links[ll]; JDFIntegerList il = rl.getCombinedProcessIndex(); if (il == null || !il.Contains(tocNum2)) { links.RemoveAt(ll); } } } if (links == null || links.Count <= i) { JDFResource r = null; // get a link hook for the matching combinedprocessindex if (bLink) { int kk = (tocNum2 == null || tocNum2.Count == 0) ? -1 : tocNum2.getInt(0); if (EnumUsage.Input.Equals(linkUsage)) { kk--; } List <JDFResource> v = null; indexResMap.TryGetValue(kk, out v); if (v != null) { int sv = v.Count; for (int kkk = 0; kkk < sv; kkk++) { JDFResource rr = v[kkk]; if (rr.LocalName.Equals(nam)) { r = rr; break; } } } } // we found no matching existing res - make a new one if (r == null) { r = node.addResource(nam, null, linkUsage, pu, null, getDevNS(), null); string id = devCap.getAttribute(AttributeName.ID, null, null); if (id != null) { JDFResourceLink rl = node.getLink(r, linkUsage); r.setID(id); if (rl != null) { rl.setrRef(id); } } if (tocNum2 == null || tocNum2.Count == 0) { indexResMap.putOne(-1, r); //(new int(-1), r); } else { indexResMap.putOne((int)tocNum2.elementAt(0), r); // only } // support // 1 // now } else // preexisting resource - just link it { e = node.linkResource(r, linkUsage, pu); } e = node.getLink(r, linkUsage); if (e != null) { JDFResourceLink rl = (JDFResourceLink)e; rl.setCombinedProcessIndex(tocNum2); } // update partititons JDFEnumerationState pidKeys = devCap.getEnumerationState(AttributeName.PARTIDKEYS); if (pidKeys != null) { VString keys = pidKeys.getAllowedValueList(); if (keys != null && keys.Count > 0) { JDFAttributeMap keyMap = new JDFAttributeMap(); for (int k = 0; k < keys.Count; k++) { string sk = "PartKey" + k; string key = keys.stringAt(k); if (key.Equals("RunIndex")) { sk = "0~-1"; } keyMap.put(key, sk); } r.getCreatePartition(keyMap, keys); } } } } else if (context.Equals(EnumContext.JMF)) { // TODO __Lena__ ... } } return(e); }