예제 #1
0
        public void testActualColorName()
        {
            colParams.setXMLComment("Note that all Strings in ColorantParams etc. use Color/@Name, NOT Color/@ActualColorName");
            colParams.setSeparations(new VString("Spot1,BlackText", ","));
            colControl.setXMLComment("Simple colorantcontrol from MIS: CMYK + 1 spot+ 1 black text version; knows no more");
            d.write2File(sm_dirTestDataTemp + "ActualColorName_MIS.jdf", 2, false);

            colControl.setXMLComment("ColorantControl after prepress has correctly set ActualColorName based on pdl content");
            JDFColor co = colPool.appendColorWithName("Black", null);

            co.setXMLComment("Color that maps the predefined separation Black\n" + "ActualColorName is the new attribute that replaces ExposedMedia/@DescriptiveName as the \"Main\" PDL color");
            co.setCMYK(new JDFCMYKColor(0, 0, 0, 1));
            Assert.IsTrue(co.isValid(EnumValidationLevel.Incomplete));
            co.setAttribute("ActualColorName", "Schwarz");

            co = colPool.appendColorWithName("Yellow", null);
            co.setAttribute("ActualColorName", "Gelb");
            co.setCMYK(new JDFCMYKColor(0, 0, 1, 0));

            co = colPool.appendColorWithName("Cyan", null);
            co.setXMLComment("ActualColorName defaults to Name if not specified");
            co.setCMYK(new JDFCMYKColor(1, 0, 0, 0));

            co = colPool.appendColorWithName("Magenta", null);
            co = colPool.appendColorWithName("Spot1", null);
            co.setAttribute("ActualColorName", "Acme Aqua");
            co.setCMYK(new JDFCMYKColor(0.7, 0.2, 0.03, 0.1));

            co = colPool.appendColorWithName("BlackText", null);
            co.setAttribute("ActualColorName", "VersionsText");
            co.setCMYK(new JDFCMYKColor(0, 0, 0, 1));

            d.write2File(sm_dirTestDataTemp + "ActualColorName_Prepress.jdf", 2, false);

            JDFColorantAlias ca = colControl.appendColorantAlias();

            ca.setXMLComment("ColorantAlias that maps the additional representation (noir) to the predefined separation Black");
            ca.setReplacementColorantName("Black");
            Assert.IsTrue(ca.isValid(EnumValidationLevel.Incomplete));
            Assert.IsFalse(ca.isValid(EnumValidationLevel.Complete));
            VString vAlias = new VString("noir schwärz", null);

            ca.setSeparations(vAlias);
            Assert.IsTrue(ca.isValid(EnumValidationLevel.Complete));
            byte[] b        = Encoding.Default.GetBytes(vAlias.stringAt(0));
            string rawNames = StringUtil.setHexBinaryBytes(b, -1) + " ";

            b         = Encoding.Default.GetBytes(vAlias.stringAt(1));
            rawNames += StringUtil.setHexBinaryBytes(b, -1);
            ca.setAttribute("RawNames", rawNames);
            d.write2File(sm_dirTestDataTemp + "ActualColorName_with_CA.jdf", 2, false);
        }
예제 #2
0
파일: RIPTest.cs 프로젝트: cip4/JDFLibNet
        public virtual void testReprintJMF()
        {
            testAuditsImageSetting();
            statCounter.setActiveNode(null, null, null);
            string           sheet        = vsSheet.stringAt(1);
            VJDFAttributeMap vmP          = new VJDFAttributeMap();
            JDFAttributeMap  attributeMap = new JDFAttributeMap(EnumPartIDKey.SheetName, sheet);

            attributeMap.put("SignatureName", "Sig1");
            attributeMap.put("Separation", vsCMYK.stringAt(3));
            attributeMap.put("Side", "Front");

            vmP.Add(attributeMap);
            statCounter.setActiveNode(n, vmP, vRL);
            string refXM    = rlXMOut.getrRef();
            string refMedia = rlMediaIn.getrRef();

            statCounter.setTrackWaste(refXM, true);
            statCounter.setTrackWaste(refMedia, false);

            statCounter.setActiveNode(n, vmP, vRL);
            statCounter.setWorkType(EnumWorkType.Rework);
            statCounter.setPhase(EnumNodeStatus.InProgress, "Imaging", EnumDeviceStatus.Running, null);
            statCounter.addPhase(refMedia, 1, 0, true);
            statCounter.addPhase(refXM, 1, 0, true);
            statCounter.setPhase(EnumNodeStatus.InProgress, "Imaging", EnumDeviceStatus.Running, null);
            JDFDoc d2  = statCounter.getDocJMFResource();
            JDFJMF jmf = d2.getJMFRoot();

            jmf.convertResponses(null);
            VElement vSigs = jmf.getMessageVector(JDFMessage.EnumFamily.Signal, JDFMessage.EnumType.Resource);

            d2.write2File(sm_dirTestDataTemp + "ImageSetResourceReprint_.jmf", 2, false);
            JDFDoc dStatusJMF = statCounter.getDocJMFPhaseTime();

            jmf = dStatusJMF.getJMFRoot();
            jmf.convertResponses(null);
            for (int i = 0; i < vSigs.Count; i++)
            {
                jmf.copyElement(vSigs.item(i), null);
            }
            dStatusJMF.write2File(sm_dirTestDataTemp + "ImageSetReprint_.jmf", 2, false);

            // JDFResourceAudit ra=
            statCounter.setResourceAudit(refMedia, EnumReason.ProcessResult);
            // JDFProcessRun pr=
            statCounter.setProcessResult(EnumNodeStatus.Completed);

            d.write2File(sm_dirTestDataTemp + "ImageSetAmount_Reprint.jdf", 2, false);
        }
예제 #3
0
        ///
        ///	 * <param name="paramString"> </param>
        ///	 * <returns> default: Usage(JDFConstants.EMPTYSTRING) </returns>
        ///
        public virtual string usage(string paramString)
        {
            m_usageTable = "\n.\n.\n.usage: ";
            if (m_argV.Count > 0)
            {
                m_usageTable += m_argV.stringAt(0);
            }

            if (m_switchParameterString != null)
            {
                m_usageTable += "\n\t switches:   -" + m_switchParameterString;
            }
            if (m_argumentParameterString != null)
            {
                m_usageTable += "\n\t Parameters: -" + m_argumentParameterString;
            }
            if (m_requiredParameterString != null)
            {
                m_usageTable += "\n\t Required:   -" + m_requiredParameterString;
            }

            m_usageTable += "\n\t Argument(s)\n";

            if (paramString.Length != 0)
            {
                m_usageTable += "\n" + paramString + "\n";
            }

            m_usageTable += "\n.\n.\n.\n";

            return(m_usageTable);
        }
예제 #4
0
        ///
        ///	 <summary> * get the minimum availability
        ///	 *  </summary>
        ///	 * <param name="vModuleRefs">
        ///	 *            the list of module ids that are evaluated </param>
        ///	 * <returns> the minimum availability, null in case of an error, for instance
        ///	 *         if no modulerefs are specified </returns>
        ///
        public virtual EnumAvailability getMinAvailability(VString vModuleRefs)
        {
            IDictionary m = getModuleMap();

            if (vModuleRefs == null || m == null || vModuleRefs.Count == 0)
            {
                return(null); // error exit
            }
            JDFDeviceCap.EnumAvailability minAvail = JDFDeviceCap.EnumAvailability.Installed;
            for (int i = 0; i < vModuleRefs.Count; i++)
            {
                JDFModuleCap mc = (JDFModuleCap)m[vModuleRefs.stringAt(i)];
                if (mc == null)
                {
                    return(null);
                }
                EnumAvailability a = mc.getAvailability();
                if (a == null || EnumAvailability.Module.Equals(a)) // module is not
                // valid
                // recursively
                {
                    return(null);
                }
                if (minAvail.CompareTo(a) > 0)
                {
                    minAvail = a;
                }
            }
            return(minAvail);
        }
예제 #5
0
 public virtual void testGetNamePathVector()
 {
     {
         JDFDevCap dc = (JDFDevCap)devicecap.getChildWithAttribute(null, AttributeName.ID, null, "dc_Ancestor", 0, false);
         VString   v  = dc.getNamePathVector(true);
         Assert.AreEqual(1, v.Count);
         Assert.AreEqual("JDF/AncestorPool/Ancestor", v.stringAt(0));
     }
     {
         JDFDevCap dc = (JDFDevCap)devicecap.getChildWithAttribute(null, AttributeName.ID, null, "dc_Layout", 0, false);
         VString   v  = dc.getNamePathVector(true);
         Assert.IsTrue(v.Count > 1);
         Assert.AreEqual("JDF/ResourcePool/Layout", v.stringAt(0));
     }
     {
         JDFDevCap dc = (JDFDevCap)devicecap.getChildWithAttribute(null, AttributeName.ID, null, "dc_LayoutLink", 0, false);
         VString   v  = dc.getNamePathVector(true);
         Assert.AreEqual(1, v.Count);
         Assert.AreEqual("JDF/ResourceLinkPool/LayoutLink", v.stringAt(0));
     }
     {
         JDFDevCap dc = (JDFDevCap)devicecap.getChildWithAttribute(null, AttributeName.ID, null, "dc_Created", 0, false);
         VString   v  = dc.getNamePathVector(true);
         Assert.AreEqual(1, v.Count);
         Assert.AreEqual("JDF/AuditPool/Created", v.stringAt(0));
     }
     {
         JDFDevCap dc = (JDFDevCap)devicecap.getChildWithAttribute(null, AttributeName.ID, null, "dc_JDF", 0, false);
         VString   v  = dc.getNamePathVector(true);
         Assert.AreEqual(1, v.Count);
         Assert.AreEqual("JDF", v.stringAt(0));
     }
 }
예제 #6
0
        public virtual void testGetNamePathVector()
        {
            JDFBooleanState b = deviceCap.getBooleanState("Template");
            VString         v = b.getNamePathVector(true);

            Assert.AreEqual(1, v.Count);
            Assert.AreEqual("JDF/@Template", v.stringAt(0));
        }
예제 #7
0
 public virtual string argument(int m)
 {
     if (m >= nargs())
     {
         return(null);
     }
     return(m_onlyArgs.stringAt(m));
 }
예제 #8
0
        ///
        ///	 <summary> * SetRange
        ///	 *  </summary>
        ///	 * <param name="VString"> s - the vector of strings to set Range to </param>
        ///
        private void setRangeOfferRange(string elementName, VString s)
        {
            removeChildren(elementName, null, null);
            int size = s.Count;

            for (int i = 0; i < size; i++)
            {
                appendTextElement(elementName, s.stringAt(i));
            }
        }
예제 #9
0
파일: UrlUtil.cs 프로젝트: cip4/JDFLibNet
        ///
        ///	 <summary> * remove any internal "../" "./" and "//" from a url
        ///	 *  </summary>
        ///	 * <param name="url"> the url to clean </param>
        ///	 * <returns> String - the clean path </returns>
        ///
        public static string cleanDots(string url)
        {
            if (url == null)
            {
                return(null);
            }
            string dummy     = url;
            int    posDouble = url.IndexOf("//");
            string prefix    = url.StartsWith("/") ? "/" : "";

            if (posDouble >= 0)
            {
                prefix = url.Substring(0, posDouble + 2);
                dummy  = url.Substring(posDouble + 2);
            }
            VString vs = new VString(StringUtil.tokenize(dummy, "/", false));

            for (int i = vs.Count - 1; i > 0; i--)
            {
                if (vs.stringAt(i).Equals("") || vs.stringAt(i).Equals("."))
                {
                    vs.RemoveAt(i);
                }
            }
            for (int i = vs.Count - 1; i > 0; i--)
            {
                if (vs.stringAt(i).Equals(".."))
                {
                    for (int j = i - 1; j >= 0; j--)
                    {
                        if (!vs.stringAt(j).Equals(".."))
                        {
                            vs.RemoveAt(i--);
                            vs.RemoveAt(j);
                            break;
                        }
                    }
                }
            }

            return(prefix + (vs.IsEmpty() ? "." : StringUtil.setvString(vs, "/", null, null)));
        }
예제 #10
0
        public void testColorantAlias()
        {
            JDFColorantAlias ca = colControl.appendColorantAlias();

            ca.setXMLComment("ColorantAlias that maps the predefined separation Black");
            ca.setReplacementColorantName("Green");
            Assert.IsTrue(ca.isValid(EnumValidationLevel.Incomplete));
            Assert.IsFalse(ca.isValid(EnumValidationLevel.Complete));
            VString vAlias = new VString("Grün grün", null);

            ca.setSeparations(vAlias);
            Assert.IsTrue(ca.isValid(EnumValidationLevel.Complete));
            byte[] b        = Encoding.Default.GetBytes(vAlias.stringAt(0));
            string rawNames = StringUtil.setHexBinaryBytes(b, -1) + " ";

            b         = Encoding.Default.GetBytes(vAlias.stringAt(1));
            rawNames += StringUtil.setHexBinaryBytes(b, -1);
            Assert.IsTrue(ca.isValid(EnumValidationLevel.Complete));
            ca.setAttribute("RawNames", rawNames);

            d.write2File(sm_dirTestDataTemp + "ColorantAlias.jdf", 2, false);
        }
예제 #11
0
        ///
        ///	 <summary> * set all separation names in the SeparationSpec elements, remove any prior
        ///	 * elements
        ///	 *  </summary>
        ///	 * <param name="vSeps">
        ///	 *            the vector of separation names to set </param>
        ///
        public virtual void setSeparations(VString vSeps)
        {
            removeChildren(ElementName.SEPARATIONSPEC, null, null);
            if (vSeps == null)
            {
                return;
            }

            for (int i = 0; i < vSeps.Count; i++)
            {
                appendSeparation(vSeps.stringAt(i));
            }
        }
예제 #12
0
파일: WebTest.cs 프로젝트: cip4/JDFLibNet
        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);
        }
예제 #13
0
        //
        //	 * // FitsValue Methods
        //

        ///
        ///	 <summary> * fitsValue - checks whether <code>value</code> matches the Allowed test
        ///	 * lists or Present test lists specified for this State
        ///	 *  </summary>
        ///	 * <param name="value">
        ///	 *            value to test </param>
        ///	 * <param name="testlists">
        ///	 *            the test lists the value has to match. In this State the test
        ///	 *            lists are RotateMod, Shift, Transforms and ValueElem.<br>
        ///	 *            Choose one of two values: FitsValue_Allowed or
        ///	 *            FitsValue_Present. (Defaults to Allowed)
        ///	 *  </param>
        ///	 * <returns> boolean - true, if the value matches all test lists or if Allowed
        ///	 *         test lists are not specified </returns>
        ///
        public override bool fitsValue(string @value, EnumFitsValue testlists)
        {
            VString vs  = new VString(@value, JDFConstants.BLANK);
            int     siz = vs.Count;

            if (siz % 6 != 0)
            {
                return(false);
            }
            List <JDFMatrix> matrixList = new List <JDFMatrix>();

            for (int i = 0; i < siz; i += 6)
            {
                VString v = new VString();
                v.Capacity = 6;
                for (int j = 0; j < 6; j++)
                {
                    v.Add(vs.stringAt(i + j));
                }

                try
                {
                    JDFMatrix m = new JDFMatrix(StringUtil.setvString(vs, " ", null, null));
                    matrixList.Add(m);
                }
                catch (FormatException)
                {
                    return(false);
                }
            }

            if (fitsListType(matrixList))
            {
                for (int k = 0; k < matrixList.Count; k++)
                {
                    JDFMatrix matrix = matrixList[k];
                    if (!fitsRotateMod(matrix, testlists) || !fitsShift(matrix, testlists) || !fitsTransforms(matrix, testlists) || !fitsValueElem(matrix, testlists))
                    {
                        return(false);
                    }
                }
                return(true);
            }
            return(false);
        }
예제 #14
0
파일: FileUtil.cs 프로젝트: cip4/JDFLibNet
 ///
 ///		 <summary> *  </summary>
 ///
 protected internal ExtensionFileFilter(string fileExtension)
 {
     if (fileExtension != null)
     {
         VString list = new VString(StringUtil.tokenize(fileExtension, ",", false));
         m_extension = new SupportClass.HashSetSupport <string>();
         for (int i = 0; i < list.Count; i++)
         {
             string st = list.stringAt(i);
             if (st.StartsWith("."))
             {
                 st = st.Substring(1);
             }
             st = st.ToLower();
             m_extension.Add(st);
         }
     }
 }
예제 #15
0
        // **************************************** Methods
        // *********************************************
        ///
        ///	 <summary> * showKeys - similar to toString but without class identifier </summary>
        ///	 * <param name="sep"> the separator key between key-entry pairs
        ///	 *  </param>
        ///	 * <returns> String </returns>
        ///
        public virtual string showKeys(string sep)
        {
            string sepLocal = sep;

            if (sepLocal == null)
            {
                sepLocal = "";
            }
            StringBuilder sb     = new StringBuilder();
            VString       vsKeys = this.getKeys();
            int           size   = vsKeys.Count;

            for (int k = 0; k < size; k++)
            {
                string strKey   = vsKeys.stringAt(k);
                string strValue = this.get(strKey);
                sb.Append(k == 0 ? "" : sepLocal).Append("(").Append(strKey).Append(" = ").Append(strValue).Append(")");
            }
            return(sb.ToString());
        }
예제 #16
0
        ///
        ///	 * <param name="m_moduleid"> the list of module ids to add, if null: nop </param>
        ///	 * <returns> the list of ModulePhase element </returns>
        ///	 * <exception cref="IllegalArgumentException"> if the vectors have different lengths </exception>
        ///
        public virtual VElement setModules(VString moduleIDs, VString moduleTypes)
        {
            if (moduleIDs == null || moduleIDs.Count == 0)
            {
                return(null);
            }
            if (moduleTypes == null || moduleTypes.Count == 0 || moduleTypes.Count != moduleIDs.Count)
            {
                throw new ArgumentException("Inconsistent vector lengths");
            }
            VElement v = new VElement();

            for (int i = 0; i < moduleIDs.Count; i++)
            {
                JDFModulePhase modulePhase = getCreateModulePhase(i);
                v.Add(modulePhase);
                modulePhase.setModuleID(moduleIDs.stringAt(i));
                modulePhase.setModuleType(moduleTypes.stringAt(i));
            }
            return(v);
        }
예제 #17
0
        ///
        ///	 <summary> * getDevCapVector()
        ///	 *  </summary>
        ///	 * <returns> VElement </returns>
        ///
        public VElement getDevCapVector()
        {
            VElement vDevCap = getChildElementVector(ElementName.DEVCAP, null, null, true, 0, false);
            string   dcr     = getAttribute(AttributeName.DEVCAPREF, null, null);

            if (dcr != null)
            {
                JDFDevCapPool dcp = getDevCapPool();
                if (dcp != null)
                {
                    VString v = new VString(StringUtil.tokenize(dcr, " ", false));
                    for (int i = 0; i < v.Count; i++)
                    {
                        string   s    = v.stringAt(i);
                        KElement dcre = dcp.getChildWithAttribute(ElementName.DEVCAP, AttributeName.ID, null, s, 0, true);
                        vDevCap.appendUnique(dcre);
                    }
                }
            }
            return(vDevCap);
        }
예제 #18
0
        //
        //	 * (non-Javadoc)
        //	 *
        //	 * @see
        //	 * org.cip4.jdflib.core.JDFElement#getInvalidAttributes(org.cip4.jdflib.
        //	 * core.KElement.EnumValidationLevel, boolean, int)
        //
        public override VString getInvalidAttributes(EnumValidationLevel level, bool bIgnorePrivate, int nMax)
        {
            VString vs = base.getInvalidAttributes(level, bIgnorePrivate, nMax);

            if (nMax > 0 && vs.Count > nMax)
            {
                return(vs);
            }
            if (!EnumValidationLevel.RecursiveComplete.Equals(level) && !EnumValidationLevel.RecursiveIncomplete.Equals(level))
            {
                return(vs);
            }
            if (vs.Contains(AttributeName.DEVCAPREF))
            {
                return(vs);
            }

            if (hasAttribute(AttributeName.DEVCAPREF))
            {
                JDFDevCapPool devCapPool = getDevCapPool();
                if (devCapPool == null)
                {
                    vs.Add(AttributeName.DEVCAPREF);
                    return(vs);
                }
                VString idRefs = getDevCapRef();
                for (int i = 0; i < idRefs.Count; i++)
                {
                    JDFDevCap devCap = devCapPool.getDevCap(idRefs.stringAt(i));
                    if (devCap == null)
                    {
                        vs.Add(AttributeName.DEVCAPREF);
                        return(vs);
                    }
                }
            }
            return(vs);
        }
예제 #19
0
        public virtual void testModules14()
        {
            VString v = new VString("orig fullList end", null);

            for (int i = 0; i < v.Count; i++)
            {
                reSetUp();
                string       testType = v.stringAt(i);
                JDFAuditPool ap       = n.getCreateAuditPool();
                ap.appendXMLComment("JDF 1.3 incompatible auditing of module phases the REQUIRED time attributes are not set in the ModulePhase elements\n" + "- note that phases may now arbitrarily overlap\n" + "The modulePhase elements now only specify which modules are involved, times are all defined by the phasetime proper", null);
                ap.appendXMLComment("The following phaseTime is executed by one module - the RIP,which executes two process steps (Interpreting and Rendering)", null);
                JDFPhaseTime ptRIP = ap.addPhaseTime(EnumNodeStatus.Setup, null, null);
                JDFDate      date  = new JDFDate();
                ptRIP.setStart(date);

                JDFDoc jmfDoc = new JDFDoc("JMF");
                JDFJMF jmf    = jmfDoc.getJMFRoot();
                jmf.setDescriptiveName("Initial phase when the RIP starts up");
                JDFSignal     signal = jmf.appendSignal(JDFMessage.EnumType.Status);
                JDFDeviceInfo di     = signal.appendDeviceInfo();

                JDFJobPhase jpRIP = di.appendJobPhase();
                di.setDeviceStatus(EnumDeviceStatus.Setup);
                jpRIP.setStartTime(date);
                jpRIP.setStatus(EnumNodeStatus.Setup);
                jpRIP.setJobID(n.getJobID(true));
                jpRIP.setJobPartID(n.getJobPartID(true));

                JDFModuleStatus msRIP = jpRIP.appendModuleStatus();
                msRIP.setCombinedProcessIndex(new JDFIntegerList("0 1"));
                msRIP.setModuleType("Imaging");
                msRIP.setModuleID("ID_Imaging");

                JDFModulePhase mpRIP = ptRIP.appendModulePhase();
                mpRIP.setCombinedProcessIndex(new JDFIntegerList("0 1"));
                mpRIP.setModuleType("Imaging");
                mpRIP.setModuleID("ID_Imaging");

                JDFModuleStatus msPrint = di.appendModuleStatus();
                msPrint.setCombinedProcessIndex(new JDFIntegerList("2"));
                msPrint.setModuleType("Printer");
                msPrint.setModuleID("ID_Printer");

                JDFModuleStatus msStitch = di.appendModuleStatus();
                msStitch.setCombinedProcessIndex(new JDFIntegerList("3"));
                msStitch.setModuleType("Stitcher");
                msStitch.setModuleID("ID_Stitcher");

                jmfDoc.write2File(sm_dirTestDataTemp + "moduleStatus" + testType + "0.jmf", 2, false);
                date.addOffset(0, 5, 0, 0);
                jmf.setTimeStamp(date);

                JDFJobPhase jpPrint = di.appendJobPhase();
                di.setDeviceStatus(EnumDeviceStatus.Running);
                jpPrint.setStatus(EnumNodeStatus.InProgress);
                jpPrint.setStartTime(date);
                jpPrint.setJobID(n.getJobID(true));
                jpPrint.setJobPartID(n.getJobPartID(true));

                msPrint = jpPrint.appendModuleStatus();
                msPrint.setCombinedProcessIndex(new JDFIntegerList("2"));
                msPrint.setModuleType("Printer");
                msPrint.setModuleID("ID_Printer");

                msStitch = jpPrint.appendModuleStatus();
                msStitch.setCombinedProcessIndex(new JDFIntegerList("3"));
                msStitch.setModuleType("Stitcher");
                msStitch.setModuleID("ID_Stitcher");

                di.removeChildren(ElementName.MODULESTATUS, null, null);
                jmf.setDescriptiveName("Phase when the Printer and Finisher start up; RIP is still RIPping");
                jmfDoc.write2File(sm_dirTestDataTemp + "moduleStatus" + testType + "1.jmf", 2, false);

                ap.appendXMLComment("The following phaseTime is executed by two modules - sticher and printer", null);
                JDFPhaseTime   ptPrint = ap.addPhaseTime(EnumNodeStatus.InProgress, null, null);
                JDFModulePhase mpPrint = ptPrint.appendModulePhase();
                mpPrint.setCombinedProcessIndex(new JDFIntegerList("2"));
                mpPrint.setModuleType("Printer");
                mpPrint.setModuleID("ID_Printer");
                ptPrint.setStart(date);

                JDFModulePhase mpStitch = ptPrint.appendModulePhase();
                mpStitch.setCombinedProcessIndex(new JDFIntegerList("3"));
                mpStitch.setModuleType("Stitcher");
                mpStitch.setModuleID("ID_Stitcher");
                date.addOffset(0, 30, 0, 0);
                ptRIP.setEnd(date);

                JDFDeviceInfo di2 = null;
                if (i < 2)
                {
                    JDFSignal signal2 = jmf.appendSignal(JDFMessage.EnumType.Status);
                    di2 = (JDFDeviceInfo)signal2.copyElement(di, null);
                    di2.removeChild(ElementName.JOBPHASE, null, 0);
                    if (i == 1)
                    {
                        JDFModuleStatus directMSRip = (JDFModuleStatus)di2.copyElement(msRIP, null);
                        directMSRip.setDeviceStatus(EnumDeviceStatus.Idle);
                    }
                }
                else
                {
                    jpRIP.setAttribute("EndTime", date.DateTimeISO);
                    jpRIP.setDescriptiveName("Added EndTime to explicitly close phase");
                }
                jmf.setTimeStamp(date);
                jmf.setDescriptiveName("Phase when the RIP has completed, Printer and Finisher are still RIPping");
                jmfDoc.write2File(sm_dirTestDataTemp + "moduleStatus" + testType + "2.jmf", 2, false);

                date.addOffset(0, 70, 0, 0);
                ptPrint.setEnd(date);
                jmf.setTimeStamp(date);

                if (i < 2)
                {
                    signal.deleteNode();
                    signal = jmf.appendSignal(JDFMessage.EnumType.Status);
                    di     = (JDFDeviceInfo)signal.copyElement(di2, null);
                    di.removeChild(ElementName.JOBPHASE, null, 0);
                    di.removeChild(ElementName.MODULESTATUS, null, 0);
                    di.setDeviceStatus(EnumDeviceStatus.Idle);
                    signal.appendXMLComment("Or should the complete list of modules also be specified here?", di);
                }
                else
                {
                    jpRIP.deleteNode();
                    jpPrint.setAttribute("EndTime", date.DateTimeISO);
                    jpPrint.setDescriptiveName("Added EndTime to explicitly close phase");
                }
                jmf.setDescriptiveName("Phase when the Printer and Finisher have completed");
                jmfDoc.write2File(sm_dirTestDataTemp + "moduleStatus" + testType + "3.jmf", 2, false);
                doc.write2File(sm_dirTestDataTemp + "DigiPrintModule.1.4" + testType + ".jdf", 2, false);
            }
        }
예제 #20
0
        public virtual void testAudits()
        {
            testPlannedWasteICS();
            VString vs = new VString("Cover Sheet1 Sheet2", " ");

            VElement vRL = new VElement();

            vRL.Add(rlOut);
            vRL.Add(rlMediaIn);

            for (int j = 0; j < 2; j++)
            {
                bool bMinimal = j == 0;

                for (int i = 0; i < vs.Count; i++)
                {
                    string           sheet = vs.stringAt(i);
                    VJDFAttributeMap vmP   = new VJDFAttributeMap();
                    vmP.Add(new JDFAttributeMap(EnumPartIDKey.SheetName, sheet));
                    StatusCounter stUtil = new StatusCounter(n, vmP, vRL);

                    string refComp  = rlOut.getrRef();
                    string refMedia = rlMediaIn.getrRef();

                    stUtil.setTrackWaste(refComp, true);
                    stUtil.setTrackWaste(refMedia, true);

                    if (i == 0)
                    {
                        stUtil.setPhase(EnumNodeStatus.Stopped, "PowerOn", EnumDeviceStatus.Stopped, "PowerOn");
                    }
                    stUtil.setPhase(EnumNodeStatus.Setup, "FormChange", EnumDeviceStatus.Setup, "FormChange");
                    stUtil.addPhase(refMedia, 0, 200, true);
                    stUtil.addPhase(refComp, 0, 200, true);
                    stUtil.setPhase(EnumNodeStatus.Setup, "FormChange", EnumDeviceStatus.Setup, "FormChange");

                    if (i >= 1 && !bMinimal)
                    {
                        JDFResourceAudit ra = stUtil.setResourceAudit(refMedia, EnumReason.ProcessResult);

                        stUtil.setResourceAudit(refComp, EnumReason.ProcessResult);

                        stUtil.clearAmounts(refMedia);
                        stUtil.addPhase(refMedia, 50, 0, true);
                        JDFResourceAudit ra2 = stUtil.setResourceAudit(refMedia, EnumReason.OperatorInput);
                        ra2.setRef(ra);
                        ra2.setDescriptiveName("manual reset to using only 50 sheets because 100 initially were wastes");
                    }
                    stUtil.setPhase(EnumNodeStatus.InProgress, "Good", EnumDeviceStatus.Running, null);
                    stUtil.addPhase(refMedia, 4000, 0, true);
                    stUtil.addPhase(refComp, 4000, 0, true);
                    stUtil.setPhase(EnumNodeStatus.Cleanup, "Washup during processing", EnumDeviceStatus.Cleanup, "Washup");
                    stUtil.setPhase(EnumNodeStatus.InProgress, "Waste", EnumDeviceStatus.Running, null);

                    stUtil.addPhase(refMedia, 0, i == 0 ? 40 : 30, true);
                    stUtil.addPhase(refComp, 0, i == 0 ? 40 : 30, true);
                    stUtil.setPhase(EnumNodeStatus.InProgress, "Good", EnumDeviceStatus.Running, null);

                    stUtil.addPhase(refMedia, 1000, 0, true);
                    stUtil.addPhase(refComp, 1000, 0, true);
                    stUtil.setPhase(EnumNodeStatus.InProgress, "Good", EnumDeviceStatus.Running, null);
                    stUtil.addPhase(refMedia, i == 0 ? 5200 : 5400, 0, true);
                    stUtil.addPhase(refComp, i == 0 ? 5200 : 5400, 0, true);
                    stUtil.setPhase(EnumNodeStatus.InProgress, "Good", EnumDeviceStatus.Running, null);

                    JDFResourceAudit ra_1 = stUtil.setResourceAudit(refMedia, EnumReason.ProcessResult);

                    if (!bMinimal)
                    {
                        stUtil.setResourceAudit(refComp, EnumReason.ProcessResult);

                        stUtil.clearAmounts(refMedia);
                        // Java to C# Conversion - Don't know the purpose of this unreachable code.  Default to the false value since 1 != 0
                        //stUtil.addPhase(refMedia, 1 == 0 ? 10100 : 10200, 0, true);
                        stUtil.addPhase(refMedia, 10200, 0, true);
                        JDFResourceAudit ra2 = stUtil.setResourceAudit(refMedia, EnumReason.OperatorInput);
                        ra2.setRef(ra_1);
                        ra2.setDescriptiveName("manual reset to using only 10200 sheets because 100 initially were  wates");
                    }
                    JDFProcessRun pr = stUtil.setProcessResult(EnumNodeStatus.Completed);
                    pr.setDescriptiveName("we even have the utterly useless ProcessRun");
                }
                if (bMinimal)
                {
                    JDFAuditPool ap     = n.getAuditPool();
                    VElement     audits = ap.getAudits(EnumAuditType.PhaseTime, null, null);
                    for (int i = 0; i < audits.Count; i++)
                    {
                        audits.item(i).deleteNode();
                    }
                }
                d.write2File(sm_dirTestDataTemp + "ConvPrintAmount_" + (bMinimal ? "min" : "full") + ".jdf", 2, false);
            }
        }
예제 #21
0
        public void testFitsValue_MatrixState()
        {
            JDFDoc  jdfDoc = new JDFDoc(ElementName.JDF);
            JDFNode root   = jdfDoc.getJDFRoot();

            JDFMatrix matrix1 = new JDFMatrix("1 0 0 1 3.14 21631.3");
            JDFMatrix matrix2 = new JDFMatrix("0 1 1 0 2 21000");

            List <ValuedEnum> transforms = new List <ValuedEnum>();

            transforms.Add(EnumOrientation.Rotate0);
            transforms.Add(EnumOrientation.Rotate270);
            transforms.Add(EnumOrientation.Flip0);
            JDFRectangle shift = new JDFRectangle("2 4 20000 23000");

            string value1 = "1 0 0 1 3.14 21631.3";

            JDFMatrixState k = (JDFMatrixState)root.appendElement("MatrixState");

            k.appendValue();
            // k.setValueValueUsage(0, EnumFitsValue.Allowed);
            k.setValueAllowedValue(0, matrix2);

            k.appendValue();
            // k.setValueValueUsage(1, EnumFitsValue.Present);
            k.setValueAllowedValue(1, matrix1);

            k.setAllowedTransforms(transforms);
            k.setAllowedShift(shift);
            k.setAllowedRotateMod(15);

            EnumListType lt = EnumListType.UniqueList;

            // JDFAbstractState.EnumListType lt = EnumListType.ListType.Unknown;
            // JDFAbstractState.EnumListType lt = EnumListType.ListType.List;
            k.setListType(lt);
            // EnumListType listType = k.getListType();

            Assert.IsTrue(k.fitsValue(value1, EnumFitsValue.Allowed), "Matrix OK");

            string @value = "1 2 3 4 5 6 7 8 9 10 11 12 3 4 5 6 7 8";

            VString vs  = new VString(@value, JDFConstants.BLANK);
            int     siz = vs.Count;

            Assert.AreEqual(0, siz % 6, "It is not a Matrix");
            VString       matrixList = new VString();
            int           i          = 0;
            StringBuilder sb         = new StringBuilder(250);

            sb.Append(vs[i]);
            while ((i + 1) < siz)
            {
                do
                {
                    sb.Append(JDFConstants.BLANK);
                    i++;
                    sb.Append(vs[i]);
                } while ((i + 1) % 6 != 0);
                matrixList.Add(sb.ToString());
                if ((i + 1) < siz)
                {
                    i++;
                    sb = new StringBuilder(250);
                    sb.Append(vs[i]);
                }
            }
            for (int z = 0; z < matrixList.Count; z++)
            {
                JDFMatrix matrix3 = new JDFMatrix(matrixList.stringAt(z));
                //matrix3.A;
            }
        }
예제 #22
0
파일: UrlUtil.cs 프로젝트: cip4/JDFLibNet
        ///
        ///	 <summary> * returns the relative URL of a file relative to the current working directory<br>
        ///	 * this includes escaping of %20 etc.
        ///	 *  </summary>
        ///	 * <param name="f"> the file to get the relative path for </param>
        ///	 * <param name="fCWD"> the file that describes cwd, if <code>null</code> cwd is calculated
        ///	 * @return </param>
        ///
        public static string getRelativePath(FileInfo f, FileInfo fCWD)
        {
            FileInfo fCWDLocal = fCWD;

            if (fCWDLocal == null)
            {
                fCWDLocal = new FileInfo(System.Environment.CurrentDirectory);
            }

            string cPath = null;
            string cwd   = null;

            try
            {
                cPath = f.FullName;
                // just in case...
                cwd = fCWDLocal.FullName;
                if (cPath[0] != cwd[0])
                {
                    return(null); // incompatible abs paths
                }
            }
            catch (IOException)
            {
                return(null);
            }
            VString vCwd  = new VString(StringUtil.tokenize(cwd, Path.DirectorySeparatorChar.ToString(), false));
            VString vPath = new VString(StringUtil.tokenize(cPath, Path.DirectorySeparatorChar.ToString(), false));

            int lenPath = vPath.Count;
            int size    = vCwd.Count;

            if (lenPath < size)
            {
                size = lenPath;
            }
            for (int i = 0; i < size; i++)
            {
                if (vCwd.stringAt(0).Equals(vPath.stringAt(0)))
                {
                    vCwd.RemoveAt(0);
                    vPath.RemoveAt(0);
                }
                else
                {
                    break;
                }
            }
            lenPath = vPath.Count;
            size    = vCwd.Count;
            string prefix = (size == 0) ? "." : "..";

            for (int i = 1; i < size; i++)
            {
                prefix += "/..";
            }

            string s = lenPath == 0 ? prefix : StringUtil.setvString(vPath, Path.DirectorySeparatorChar.ToString(), prefix + Path.DirectorySeparatorChar.ToString(), null);

            return(cleanDots(s));
        }
예제 #23
0
        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);
        }
예제 #24
0
        ///
        ///	 <summary> * gets the XPath to the attributes of a given JDF node
        ///	 *  </summary>
        ///	 * <param name="jdf">
        ///	 *            JDF node to test </param>
        ///	 * <returns> String - the XPath to the attributes </returns>
        ///
        protected internal virtual string getEvalXPath(KElement jdf)
        {
            ICapabilityElement stateDC = getRefTarget();

            if (stateDC == null)
            {
                return(null);
            }

            VString vPath    = null;
            bool    bElement = false;
            string  attName  = null;

            if (stateDC is JDFDevCap)
            {
                if (!(this is JDFIsPresentEvaluation)) // only ispresent may
                // reference a
                // devcap, all
                // others must
                // reference a state
                {
                    return(null);
                }
                bElement = true;
                JDFDevCap dc = (JDFDevCap)stateDC;
                vPath = dc.getNamePathVector(true);
                // fix up for the fact that ispresent for a resource is actually a
                // link
                if (vPath != null)
                {
                    for (int i = 0; i < vPath.Count; i++)
                    {
                        string  path   = vPath.stringAt(i);
                        VString tokens = new VString(StringUtil.tokenize(path, "/", false));
                        if (tokens.Count == 3 && tokens.stringAt(1).Equals(ElementName.RESOURCEPOOL))
                        {
                            tokens[1] = ElementName.RESOURCELINKPOOL;
                            tokens[2] = tokens.stringAt(2) + "Link";
                            vPath[i]  = StringUtil.setvString(tokens, "/", null, null);
                        }
                    }
                }
            }
            else if (stateDC is JDFDevCaps)
            {
                if (!(this is JDFIsPresentEvaluation)) // only ispresent may
                // reference a
                // devcap, all
                // others must
                // reference a state
                {
                    return(null);
                }
                bElement = true;
                JDFDevCaps dc = (JDFDevCaps)stateDC;
                vPath = dc.getNamePathVector();
                // fix up for the fact that ispresent for a resource is actually a
                // link
                if (vPath != null)
                {
                    for (int i = 0; i < vPath.Count; i++)
                    {
                        string  path   = vPath.stringAt(i);
                        VString tokens = new VString(StringUtil.tokenize(path, "/", false));
                        if (tokens.Count == 3 && tokens.stringAt(1).Equals(ElementName.RESOURCEPOOL))
                        {
                            tokens[1] = ElementName.RESOURCELINKPOOL;
                            string    link = tokens.stringAt(2) + "Link";
                            EnumUsage lu   = dc.getLinkUsage();
                            if (lu != null)
                            {
                                link += "[@Usage=\"" + lu.getName() + "\"]";
                            }
                            tokens[2] = link;
                            vPath[i]  = StringUtil.setvString(tokens, "/", null, null);
                        }
                    }
                }
            }
            else
            {
                // we have found our state -> take its xPath and look for
                // corresponding elem in JDFNode, we test

                JDFAbstractState state = (JDFAbstractState)stateDC;
                if (state.getListType().Equals(EnumListType.Span))
                {
                    vPath    = state.getNamePathVector(true);
                    bElement = true;
                }
                else
                {
                    KElement kdc = state.getParentNode_KElement();
                    if (kdc is IDeviceCapable)
                    {
                        vPath = ((IDeviceCapable)kdc).getNamePathVector();
                    }
                    else if (kdc is ICapabilityElement)
                    {
                        vPath = ((ICapabilityElement)kdc).getNamePathVector();
                    }
                    attName = state.getName();
                }
            }
            if (vPath != null)
            {
                for (int i = 0; i < vPath.Count; i++)
                {
                    string xPath  = vPath.stringAt(i);
                    int    slash  = xPath.Length;
                    string finalS = null;
                    do
                    {
                        string xPath2 = xPath.Substring(0, slash);
                        if (jdf.matchesPath(xPath2, true))
                        {
                            finalS = "." + xPath.Substring(slash);
                        }
                        slash = xPath2.LastIndexOf("/");
                    } while (slash >= 0 && finalS == null);

                    if (finalS != null && !bElement)
                    {
                        finalS += "/@" + attName;
                    }
                    if (finalS != null)
                    {
                        return(finalS);
                    }
                }
            }
            return(null);
        }
예제 #25
0
        ///
        ///	 * <param name="icsLevel"> </param>
        ///
        protected internal virtual void initColorantControl()
        {
            JDFResourceLink ccLink = null;

            if (thePreviousNode != null)
            {
                ccLink = theNode.linkResource(thePreviousNode.getResource(ElementName.COLORANTCONTROL, EnumUsage.Input, 0), EnumUsage.Input, null);
            }
            if (ccLink == null && theParentNode != null)
            {
                ccLink = theNode.linkResource(theParentNode.getResource(ElementName.COLORANTCONTROL, EnumUsage.Input, 0), EnumUsage.Input, null);
            }

            JDFColorantControl cc = (JDFColorantControl)(ccLink == null ? (JDFColorantControl)theNode.getCreateResource(ElementName.COLORANTCONTROL, EnumUsage.Input, 0) : ccLink.getTarget());

            cc.setResStatus(EnumResStatus.Available, false);

            JDFColorPool cp = (JDFColorPool)theNode.getJDFRoot().getChildByTagName(ElementName.COLORPOOL, null, 0, null, false, false);

            if (cp == null)
            {
                cp = (JDFColorPool)theNode.getCreateResource(ElementName.COLORPOOL, EnumUsage.Input, 0);
                if (theParentNode != null)
                {
                    theParentNode.getCreateResourcePool().moveElement(cp, null);
                }
            }

            cc.refColorPool(cp);
            for (int i = 4; i < getNCols(); i++)
            {
                cc.getCreateColorantParams().appendSeparation(cols.stringAt(i));
            }
            for (int i = 0; i < getNCols(); i++)
            {
                string   name = cols.stringAt(i);
                JDFColor c    = cp.getCreateColorWithName(name, null);
                if (i == 0)
                {
                    c.setCMYK(new JDFCMYKColor(1, 0, 0, 0));
                }
                if (i == 1)
                {
                    c.setCMYK(new JDFCMYKColor(0, 1, 0, 0));
                }
                if (i == 2)
                {
                    c.setCMYK(new JDFCMYKColor(0, 0, 1, 0));
                }
                if (i == 3)
                {
                    c.setCMYK(new JDFCMYKColor(0, 0, 0, 1));
                }
            }
            cc.setProcessColorModel("DeviceCMYK");
            if (nCols[0] != nCols[1])
            {
                for (int ii = 0; ii < 2; ii++)
                {
                    JDFColorantControl ccP   = (JDFColorantControl)cc.addPartition(EnumPartIDKey.Side, ii == 0 ? "Front" : "Back");
                    VString            colsP = new VString();
                    for (int iii = 0; iii < nCols[ii]; iii++)
                    {
                        colsP.Add(cols.stringAt(iii));
                    }
                    JDFSeparationList co = ccP.getCreateColorantOrder();
                    co.setSeparations(colsP);
                }
            }
            else
            {
                JDFSeparationList co = cc.getCreateColorantOrder();
                co.setSeparations(cols);
            }
        }
예제 #26
0
        ///
        ///	 * <param name="n"> </param>
        ///	 * <param name="rlOut"> </param>
        ///
        private void setupLayout(bool complex)
        {
            JDFLayout    lo         = (JDFLayout)n.appendMatchingResource("Layout", EnumProcessUsage.AnyInput, null);
            JDFLayerList ll         = lo.appendLayerList();
            const string layerNames = "BackGround Language";

            VString layers = new VString(layerNames, " ");

            if (complex)
            {
                layers.Add("Currency");
            }

            for (int i = 0; i < layers.Count; i++)
            {
                ll.appendLayerDetails().setName(layers.stringAt(i));
            }

            JDFRunList rlOutDe = (JDFRunList)rlOut.addPartition(EnumPartIDKey.PartVersion, "De");

            rlOutDe.setResStatus(EnumResStatus.Available, true);
            JDFRunList rlOutEn = (JDFRunList)rlOut.addPartition(EnumPartIDKey.PartVersion, "Fr");

            rlOutEn.setResStatus(EnumResStatus.Unavailable, true);
            if (complex)
            {
                JDFRunList rlOutSwiss = (JDFRunList)rlOut.addPartition(EnumPartIDKey.PartVersion, "Ch");
                rlOutSwiss.setResStatus(EnumResStatus.Unavailable, true);
            }

            for (int i = 0; i < 2; i++)
            {
                string     sheetName = "Sheet" + i;
                JDFLayout  lSheet    = (JDFLayout)lo.addPartition(EnumPartIDKey.SheetName, sheetName);
                JDFRunList rlSheet   = (JDFRunList)rlOutDe.addPartition(EnumPartIDKey.SheetName, sheetName);
                for (int j = 0; j < 2; j++)
                {
                    string     side   = j == 0 ? "Front" : "Back";
                    JDFLayout  lSide  = (JDFLayout)lSheet.addPartition(EnumPartIDKey.Side, side);
                    JDFRunList rlSide = (JDFRunList)rlSheet.addPartition(EnumPartIDKey.Side, side);
                    rlSide.setFileURL("file://out/De/" + sheetName + "_" + side + ".tif");
                    for (int k = 0; k < 4; k++)
                    {
                        JDFContentObject poBkg = lSide.appendContentObject();
                        int ord = i * 8 + j * 4 + k;
                        poBkg.setOrd(ord);
                        poBkg.setOrdID(ord);

                        JDFMatrix matrix = new JDFMatrix(1.0, 0.0, 0.0, 1.0, 0.0, 0.0);
                        matrix.shift((k % 2) * 200, (k / 2) * 300);
                        poBkg.setCTM(matrix);
                        poBkg.setLayerID(0);

                        JDFContentObject poLang = lSide.appendContentObject();
                        poLang.setOrd(ord + 16);
                        poLang.setOrdID(ord);
                        poLang.setCTM(matrix);
                        poLang.setLayerID(1);

                        if (complex)
                        {
                            JDFContentObject pOCurr = lSide.appendContentObject();
                            pOCurr.setOrd(ord + 32);
                            pOCurr.setOrdID(ord);
                            pOCurr.setCTM(matrix);
                            pOCurr.setLayerID(2);
                        }
                    }
                }
            }
        }
예제 #27
0
        ///
        ///	 <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);
        }