public KeyInfoType() { itemsField = new object[0]; itemsElementNameField = new ItemsChoiceType2[0]; textField = new string[0]; // idField = string.Empty }
public object GetValueFor(ItemsChoiceType2 choice) { var idx = GetIndexFor(choice); if (idx == -1) return null; return Items[idx]; }
private int GetIndexFor(ItemsChoiceType2 choice) { for (int i = 0; i != ItemsElementName.Length; ++i) if (ItemsElementName[i] == choice) return i; return -1; }
public InvoiceBuilder() { _invoice = new Invoice(); InvoiceHeader invoiceHeader = new InvoiceHeader(); invoiceHeader.DocNumber = "000101"; invoiceHeader.Msg = "No Black Ink Pens"; invoiceHeader.Note = "Blue Ink pens only"; IdType customerId = new IdType(); customerId.Value = "5"; invoiceHeader.CustomerId = customerId; invoiceHeader.SubTotalAmt = decimal.Parse("200.00"); invoiceHeader.SubTotalAmtSpecified = true; invoiceHeader.TotalAmt = decimal.Parse("298.75"); invoiceHeader.TotalAmtSpecified = true; invoiceHeader.BillEmail = "*****@*****.**"; invoiceHeader.ItemElementName = ItemChoiceType2.DiscountAmt; invoiceHeader.Item = decimal.Parse("-1.25"); invoiceHeader.TxnDate = DateTime.Parse("2010-08-07"); invoiceHeader.TxnDateSpecified = true; invoiceHeader.DueDate = DateTime.Parse("2010-08-16"); invoiceHeader.DueDateSpecified = true; _invoice.Header = invoiceHeader; InvoiceLine invoiceLine = new InvoiceLine(); invoiceLine.Desc = "Pens"; invoiceLine.Amount = decimal.Parse("200.00"); invoiceLine.AmountSpecified = true; invoiceLine.Taxable = true; invoiceLine.TaxableSpecified = true; IdType itemId = new IdType(); itemId.Value = "4"; object[] items = new object[3]; ItemsChoiceType2[] elementNames = new ItemsChoiceType2[3]; elementNames[0] = ItemsChoiceType2.ItemId; items[0] = itemId; elementNames[1] = ItemsChoiceType2.UnitPrice; items[1] = decimal.Parse("100"); ; elementNames[2] = ItemsChoiceType2.Qty; items[2] = decimal.Parse("4"); invoiceLine.ItemsElementName = elementNames; invoiceLine.Items = items; List<InvoiceLine> lines = new List<InvoiceLine>(); lines.Add(invoiceLine); _invoice.Line = lines.ToArray(); }
internal IDAESceneNode GetSceneNode(DAELoaderNode loader) { List <IDAESceneNode> children = new List <IDAESceneNode>(); // load geometry if (_node.instance_geometry != null && _node.instance_geometry.Length > 0) { foreach (var instGeo in _node.instance_geometry) { Dictionary <string, string> instanceMaterials = new Dictionary <string, string>(); if (instGeo.bind_material != null) { foreach (instance_material instMat in instGeo.bind_material.technique_common) { instanceMaterials.Add(instMat.symbol, instMat.target); } } DAEGeometry geo = loader.LibGeometries.GetGeometry(loader, DAEUtils.GetUrl(instGeo.url).Id); List <IDAEShapeNode> shapes = geo.GetShapeNodes(loader, instanceMaterials, _node.name); foreach (IDAEShapeNode shape in shapes) { children.Add(shape); } } } // load lights if (_node.instance_light != null && _node.instance_light.Length > 0) { foreach (var instLight in _node.instance_light) { IDAESceneNode lightNode = loader.LibLights.GetLightNode(loader, DAEUtils.GetUrl(instLight.url).Id); if (lightNode != null) { children.Add(lightNode); } } } // load local children if (_node.node1 != null && _node.node1.Length > 0) { foreach (node child in _node.node1) { DAENode n = new DAENode(child); IDAESceneNode childNode = n.GetSceneNode(loader); if (childNode != null) { children.Add(childNode); } } } // load remote children if (_node.instance_node != null) { foreach (InstanceWithExtra child in _node.instance_node) { IDAESceneNode childNode = null; var url = DAEUtils.GetUrl(child.url); if (string.IsNullOrEmpty(url.FilePath)) { childNode = loader.LibNodes.GetSceneNode(loader, url.Id); } else { var extLoader = loader.GetLoaderForUrl(url); childNode = extLoader.GetSceneGraph(); //TODO only load node with url.Id } if (childNode != null) { children.Add(childNode); } } } // load transformation DAEMatrix4 finalTrans = DAEMatrix4.Identity; if (_node.Items != null) { for (int i = 0; i < _node.Items.Length; i++) { object trans = _node.Items[i]; ItemsChoiceType2 transType = _node.ItemsElementName[i]; if (transType == ItemsChoiceType2.matrix) { matrix m = trans as matrix; DAEMatrix4 k = DAEMatrix4.Identity; k.M11 = m.Values[0]; k.M12 = m.Values[1]; k.M13 = m.Values[2]; k.M14 = m.Values[3]; k.M21 = m.Values[4]; k.M22 = m.Values[5]; k.M23 = m.Values[6]; k.M24 = m.Values[7]; k.M31 = m.Values[8]; k.M32 = m.Values[9]; k.M33 = m.Values[10]; k.M34 = m.Values[11]; k.M41 = m.Values[12]; k.M42 = m.Values[13]; k.M43 = m.Values[14]; k.M44 = m.Values[15]; finalTrans *= k; } else if (transType == ItemsChoiceType2.rotate) { rotate r = trans as rotate; finalTrans *= DAEMatrix4.Rotation(r.Values[0], r.Values[1], r.Values[2], (r.Values[3] * System.Math.PI / 180)); } else if (transType == ItemsChoiceType2.lookat) { //lookat l = trans as lookat; //finalTrans *= SharpDX.Matrix.LookAtLH( // new SharpDX.Vector3((float)l.Values[0], (float)l.Values[1], (float)l.Values[2]), // new SharpDX.Vector3((float)l.Values[3], (float)l.Values[4], (float)l.Values[5]), // new SharpDX.Vector3((float)l.Values[6], (float)l.Values[7], (float)l.Values[8])); // not implemented } else if (transType == ItemsChoiceType2.scale) { TargetableFloat3 s = trans as TargetableFloat3; finalTrans *= DAEMatrix4.Scaling(s.Values[0], s.Values[1], s.Values[2]); } else if (transType == ItemsChoiceType2.translate) { TargetableFloat3 t = trans as TargetableFloat3; finalTrans *= DAEMatrix4.Translation(t.Values[0], t.Values[1], t.Values[2]); } else if (transType == ItemsChoiceType2.skew) { // not implemented } } } return(loader.Context.CreateGroupNode(_node.name, finalTrans, children.ToArray())); }
public bool HasValueFor(ItemsChoiceType2 choice) { return GetValueFor(choice) != null; }