Example #1
0
        private void setField()
        {
            fieldAliases.Clear();
            IFieldConsumer c = this;

            foreach (string fn in extAliases.Keys)
            {
                Dictionary <int, string> an = extAliases[fn];
                foreach (IPhysicalField field in fields)
                {
                    string na = this.GetRelativeName(field as IAssociatedObject);
                    if (na.Equals(fn))
                    {
                        Dictionary <int, Transformer> d = new Dictionary <int, Transformer>();
                        fieldAliases[field] = d;
                        foreach (int num in an.Keys)
                        {
                            AliasName   aln = this.FindAliasName(an[num], true);
                            Transformer tr  = new Transformer();
                            tr.an  = aln;
                            tr.tr  = FieldTransformer.Create(field.GetType(num), field.GetTransformationType(num));
                            d[num] = tr;
                        }
                    }
                }
            }
        }
Example #2
0
        private void update()
        {
            IDataConsumer  cons  = this;
            ReferenceFrame frame = position.GetParentFrame();
            int            ncol  = colored ? 3 : 1;

            foreach (IPhysicalField field in fieldAliases.Keys)
            {
                IPositionObject po = field as IPositionObject;
                ReferenceFrame  ff = po.Position.GetParentFrame();
                ReferenceFrame.GetRelativeFrame(ff, frame, relative);
                Dictionary <int, Transformer> d = fieldAliases[field];
                foreach (int nf in d.Keys)
                {
                    Transformer      tr         = d[nf];
                    FieldTransformer transfomer = tr.tr;
                    tr.tr.Set(relative);
                }
                int fc = facet.Count;
                for (int i = 0; i < fc; i++)
                {
                    double[] p = facet[i];
                    relative.GetRelativePosition(p, pos);
                    object[] o = field[pos];
                    foreach (int nf in d.Keys)
                    {
                        Transformer tr = d[nf];
                        object      ot = tr.tr.Transform(o[nf]);
                        tr.an.SetValue(ot);
                    }
                    foreach (int ns in surfaceAliaes.Keys)
                    {
                        object sp = facet[i, ns];
                        surfaceAliaes[ns].SetValue(sp);
                    }
                    this.FullReset();
                    cons.UpdateChildrenData();
                    for (int j = 0; j < measures.Count; j++)
                    {
                        parameters[i, j] = measures[j].Parameter();
                    }
                    if (colorMea[0] == null)
                    {
                        continue;
                    }
                    for (int nnc = 0; nnc < ncol; nnc++)
                    {
                        double col = (double)colorMea[0].Parameter();
                        if (proportional)
                        {
                            if (i == 0)
                            {
                                min[nnc] = col;
                                max[nnc] = col;
                            }
                            else
                            {
                                if (min[nnc] > col)
                                {
                                    min[nnc] = col;
                                }
                                if (max[nnc] < col)
                                {
                                    max[nnc] = col;
                                }
                            }
                            colorValues[i, nnc] = col;
                        }
                    }
                }
            }
            if (colorMea[0] != null)
            {
                draw();
            }
        }