public string[] GetFormulasU(ShapeSheet.Streams.StreamArray stream)
        {
            if (stream.Array.Length == 0)
            {
                return(new string[0]);
            }

            System.Array formulas_sa = null;

            if (this.Master != null)
            {
                this.Master.GetFormulasU(stream.Array, out formulas_sa);
            }
            else if (this.Page != null)
            {
                this.Page.GetFormulasU(stream.Array, out formulas_sa);
            }
            else if (this.Shape != null)
            {
                this.Shape.GetFormulasU(stream.Array, out formulas_sa);
            }
            else
            {
                throw new System.ArgumentException("Unhandled Drawing Surface");
            }

            var formulas = system_array_to_typed_array <string>(formulas_sa);

            return(formulas);
        }
        public int SetResults(ShapeSheet.Streams.StreamArray stream, object[] unitcodes, object[] results, short flags)
        {
            if (results.Length != stream.Count)
            {
                string msg =
                    string.Format("stream contains {0} items ({1} short values) and requires {2} result values",
                                  stream.Count, stream.Array.Length, stream.Count);
                throw new System.ArgumentException(msg);
            }

            if (this.Shape != null)
            {
                return(this.Shape.SetResults(stream.Array, unitcodes, results, flags));
            }
            else if (this.Master != null)
            {
                return(this.Master.SetResults(stream.Array, unitcodes, results, flags));
            }
            else if (this.Page != null)
            {
                return(this.Page.SetResults(stream.Array, unitcodes, results, flags));
            }

            throw new System.ArgumentException("Unhandled Target");
        }
        public         TResult[] GetResults <TResult>(ShapeSheet.Streams.StreamArray stream, object[] unitcodes)
        {
            if (stream.Array.Length == 0)
            {
                return(new TResult[0]);
            }

            _enforce_valid_result_type(typeof(TResult));

            var flags = TypeToVisGetSetArgs(typeof(TResult));

            System.Array results_sa = null;

            if (this.Master != null)
            {
                this.Master.GetResults(stream.Array, (short)flags, unitcodes, out results_sa);
            }
            else if (this.Page != null)
            {
                this.Page.GetResults(stream.Array, (short)flags, unitcodes, out results_sa);
            }
            else if (this.Shape != null)
            {
                this.Shape.GetResults(stream.Array, (short)flags, unitcodes, out results_sa);
            }
            else
            {
                throw new System.ArgumentException("Unhandled Target");
            }

            var results = system_array_to_typed_array <TResult>(results_sa);

            return(results);
        }
Example #4
0
        public int SetFormulas(Streams.StreamArray stream, object[] formulas, short flags)
        {
            if (formulas.Length != stream.Count)
            {
                string msg =
                    string.Format("stream contains {0} items ({1} short values) and requires {2} formula values",
                                  stream.Count, stream.Array.Length, stream.Count);
                throw new ArgumentException(msg);
            }

            if (this.Target.Shape != null)
            {
                return(this.Target.Shape.SetFormulas(stream.Array, formulas, flags));
            }
            else if (this.Target.Master != null)
            {
                return(this.Target.Master.SetFormulas(stream.Array, formulas, flags));
            }
            else if (this.Target.Page != null)
            {
                return(this.Target.Page.SetFormulas(stream.Array, formulas, flags));
            }

            throw new System.ArgumentException("Unhandled Target");
        }
        public static VASS.Streams.StreamArray FromSrc(int numcells, IEnumerable <Src> sidsrcs)
        {
            var num_shorts = numcells * 3;
            var array      = new short[num_shorts];
            var stream     = new StreamArray(array, CellCoordinateType.Src, numcells);

            int i = 0;
            int j = 0;

            foreach (var src in sidsrcs)
            {
                if (j >= numcells)
                {
                    break;
                }
                array[i++] = src.Section;
                array[i++] = src.Row;
                array[i++] = src.Cell;
                j++;
            }
            return(stream);
        }