private object[] GetFieldValue(IPhysicalField field) { if (fieldValue.ContainsKey(field)) { return(fieldValue[field]); } object[] o = new object[field.Count]; for (int i = 0; i < o.Length; i++) { object type = field.GetType(i); if (type.GetType().Equals(typeof(double))) { double a = 0; o[i] = a; continue; } if (type is ArrayReturnType) { ArrayReturnType art = type as ArrayReturnType; o[i] = new double[art.Dimension[0]]; } fieldValue[field] = o; } return(o); }
private void CreateMesurements(IPhysicalField field) { string name = this.GetRelativeName(field as IAssociatedObject) + "_"; name = name.Replace(".", "_"); name = name.Replace("/", "_"); int n = field.Count; IList <IMeasurement> lm = new List <IMeasurement>(); IList <ProcessField> pr = new List <ProcessField>(); IList <object> lo = new List <object>(); dic[field] = lm; proc[field] = pr; results[field] = lo; IMeasurement mea = null; measures.Clear(); for (int i = 0; i < n; i++) { object result = null; ProcessField pf = null; string na = name + (i + 1); object type = field.GetType(i); object tt = field.GetTransformationType(i); if (type is ArrayReturnType) { if (tt.Equals(Field3D_Types.CovariantVector)) { pf = ProcessCovariantVector; } else { pf = ProcessInvariantVector; } ArrayReturnType art = type as ArrayReturnType; int dim = art.Dimension[0]; result = new double[dim]; mea = new FieldMeasurement(na, type, result); } else { pf = ProcessSimpleType; result = new object[1]; mea = new FieldMeasurementElement(na, type, result as object[]); } lm.Add(mea); pr.Add(pf); lo.Add(result); measures.Add(mea); } }
void fillField() { Panel p = panelFieldParameters; p.Controls.Clear(); fieldCombo.Clear(); IFieldConsumer cons = consumer; int y = 0; for (int i = 0; i < cons.Count; i++) { IPhysicalField ph = cons[i]; Control h = DataPerformer.UI.HeaderControl.GetHeaderControl(consumer as IAssociatedObject, ph as IAssociatedObject); h.Left = 0; h.Top = y; p.Controls.Add(h); y = h.Bottom; List <ComboBox> lb = new List <ComboBox>(); fieldCombo.Add(lb); for (int j = 0; j < ph.Count; j++) { object t = ph.GetType(j); string tn = " (" + Measurement.GetTypeName(t) + ")"; Label l = new Label(); l.Text = ResourceService.Resources.GetControlResource("Parameter", Motion6D.UI.Utils.ControlUtilites.Resources) + " " + (j + 1) + tn; l.Left = 10; l.Top = y; l.Width = 400; p.Controls.Add(l); ComboBox cb = new ComboBox(); lb.Add(cb); cb.Top = l.Bottom + 5; cb.Left = l.Left + 50; cb.Width = p.Width - cb.Left - 20; p.Controls.Add(cb); IList <string> list = consumer.GetAliases(t); cb.FillCombo(list); y = cb.Bottom + 5; } Panel sep = new Panel(); sep.Width = p.Width - 20; sep.BackColor = Color.Black; sep.Height = 3; sep.Top = y; p.Controls.Add(sep); y = sep.Bottom; } selectField(); }
public static int[] GetFields(IPhysicalField field, object type, object transformationType) { List <int> l = new List <int>(); int n = field.Count; for (int i = 0; i < n; i++) { object t = field.GetType(i); object tr = field.GetTransformationType(i); if (t.Equals(type) & tr.Equals(transformationType)) { l.Add(i); } } return(l.ToArray()); }