Пример #1
0
 public CItem Parse(XPathDocument doc)
 {
     var docnav = doc.CreateNavigator ();
     docnav.MoveToFollowing ("photo", "");
     var item = new CItem (docnav);
     docnav.MoveToFollowing ("Mpeg7", "");
     docnav.MoveToFollowing ("Image", "");
     foreach (XPathNavigator nav in docnav.Select("*")) {
         var _type = nav.GetAttribute ("type", "");
         //Console.WriteLine("type: {0}", _type);
         //Console.WriteLine(nav.OuterXml);
         switch (_type) {
         case "ScalableColorType":
             PrimitiveIO<short>.LoadVector (nav.Value, item.ScalableColor, 0, item.ScalableColor.Length);
             break;
         case "ColorStructureType":
             PrimitiveIO<short>.LoadVector (nav.Value, item.ColorStructure, 0, item.ColorStructure.Length);
             break;
         case "ColorLayoutType":
             item.SetColorLayout (nav);
             break;
         case "EdgeHistogramType":
             PrimitiveIO<short>.LoadVector (nav.Value, item.EdgeHistogram, 0, item.EdgeHistogram.Length);
             break;
         case "HomogeneousTextureType":
             item.SetHomegeneousTexture (nav);
             break;
         default:
             throw new ArgumentException (String.Format("Unknown node type '{0}'"));
         }
     }
     return item;
 }