Exemple #1
0
 public override IList<IElement> End(IWorkerContext ctx, Tag tag,
             IList<IElement> currentContent)
 {
     Path path = null;
     try
     {
         IDictionary<String, String> attributes = tag.Attributes;
         SvgPipelineContext context = GetSvgPipelineContext(ctx);
         String id;
         if (attributes.TryGetValue("xlink:href", out id) && id != null)
         {
             IList<IElement> list = context.GetSymbolById(id.Substring(1));
             //TODO need to check that the element list contains only one element 
             //and the type needs to be Path
             if (list != null && list.Count == 1) {
                 path = (Path)list[0];
             }
         }
     }
     catch (NoCustomContextException e)
     {
         throw new RuntimeWorkerException(e);
     }
     //if the path is not found, do exactly the same as when Text
     if (path == null && currentContent.Count > 0)
     {
         TextGroup group =
             new TextGroup(currentContent, 0, 0, 500f, 500f, tag.CSS);
         IList<IElement> l = new List<IElement>(1);
         l.Add(group);
         return l;
     }
     else if (currentContent.Count > 0)
     {
         TextPathGroup group =
             new TextPathGroup(currentContent, 0, 0, 500f, 500f, tag.CSS, path);
         IList<IElement> l = new List<IElement>(1);
         l.Add(group);
         return l;
     }
     //draw the content
     return new List<IElement>(0);
 }
Exemple #2
0
	    public override IList<IElement> End(IWorkerContext ctx, Tag tag,
				    IList<IElement> currentContent) {
		    IList<IElement> l = new List<IElement>();
    		
		    //draw everything between the brackets at once				
		    if(currentContent.Count > 0){
			    IList<IElement> list = new List<IElement>();
			    foreach (IElement element in currentContent) {
				    if(element is TextPathGroup){
					    l.Add(element);
				    }else if (element is Text){
					    list.Add(element);
				    }
			    }			
			    if(list.Count > 0){
				    TextGroup group = 
					    new TextGroup(list, 0, 0, 500f, 500f, tag.CSS);				
				    l.Add(group);
			    }
		    }
		    //draw the content
		    return l;
	    }