예제 #1
0
 /**
  * @param po
  * @throws PipelineException
  */
 private void Write(IWorkerContext context, ProcessObject po) {
     MapContext mp = (MapContext)GetLocalContext(context);
     if (po.ContainsWritable()) {
         Document doc = (Document) mp[DOCUMENT];
         bool continuousWrite = (bool) mp[CONTINUOUS];
         IWritable writable = null;
         while (null != (writable = po.Poll())) {
             if (writable is WritableElement) {
                 foreach (IElement e in ((WritableElement) writable).Elements()) {
                     try {
                         if (!doc.Add(e) && LOG.IsLogging(Level.TRACE)) {
                             LOG.Trace(String.Format(
                                     LocaleMessages.GetInstance().GetMessage(LocaleMessages.ELEMENT_NOT_ADDED),
                                     e.ToString()));
                         }
                     } catch (DocumentException e1) {
                         if (!continuousWrite) {
                             throw new PipelineException(e1);
                         } else {
                             LOG.Error(
                                     LocaleMessages.GetInstance().GetMessage(LocaleMessages.ELEMENT_NOT_ADDED_EXC),
                                     e1);
                         }
                     }
                 }
             }
         }
     }
 }
 /**
  * Called in <code>open</code>, <code>content</code> and <code>close</code> to pass the {@link Writable}s to the handler
  * @param po
  */
 private void Consume(IWorkerContext context, ProcessObject po)
 {
     if (po.ContainsWritable())
     {
         IWritable w = null;
         while (null != (w = po.Poll()))
         {
             handler.Add(w);
         }
     }
 }
예제 #3
0
        /**
         * @param po
         * @throws PipelineException
         */

        //lijst met graphische elementen (en andere?)
        private void Write(IWorkerContext context, ProcessObject po, Tag t)
        {
            //MapContext mp = GetLocalContext(context);
            if (po.ContainsWritable()) {
                //Document doc = (Document) mp.Get(DOCUMENT);
                //bool continuousWrite = (Boolean) mp.Get(CONTINUOUS);
                IWritable writable = null;
                while (null != (writable = po.Poll())) {
                    if (writable is Graphic) {
                        ((Graphic)writable).Draw(template, t.CSS);
                        if (writable is Svg) {
                            Svg svg = (Svg)writable;
                            text.Rectangle viewBox = svg.ViewBox;
                            template.BoundingBox = new text.Rectangle(viewBox.Width, viewBox.Height);
                        }
                    }
                }
            }
        }
예제 #4
0
        /**
         * @param po
         * @throws PipelineException
         */

        //lijst met graphische elementen (en andere?)
        private void Write(IWorkerContext context, ProcessObject po, Tag t)
        {
            //MapContext mp = GetLocalContext(context);
            if (po.ContainsWritable())
            {
                //Document doc = (Document) mp.Get(DOCUMENT);
                //bool continuousWrite = (Boolean) mp.Get(CONTINUOUS);
                IWritable writable = null;
                while (null != (writable = po.Poll()))
                {
                    if (writable is Graphic)
                    {
                        ((Graphic)writable).Draw(template, t.CSS);
                        if (writable is Svg)
                        {
                            Svg            svg     = (Svg)writable;
                            text.Rectangle viewBox = svg.ViewBox;
                            template.BoundingBox = new text.Rectangle(viewBox.Width, viewBox.Height);
                        }
                    }
                }
            }
        }