private void ConvertBandCenterWaveNumToArg(ref AlgorithmDef alg)
        {
            if (alg.Bands == null || alg.Bands.Length == 0)
            {
                return;
            }
            ArgumentBase[] args = new ArgumentBase[alg.Arguments.Length + alg.Bands.Length];
            for (int i = 0; i < alg.Arguments.Length; i++)
            {
                args[i] = alg.Arguments[i];
            }
            int idx = alg.Arguments.Length;

            foreach (BandDef band in alg.Bands)
            {
                ArgumentDef arg = new ArgumentDef();
                arg.Name         = (band.Identify + "_CenterWaveNum");
                arg.Datatype     = "double";
                arg.Description  = arg.Name;
                arg.Visible      = false;
                arg.Defaultvalue = (band.CenterWaveNum).ToString();
                args[idx++]      = arg;
            }
            alg.Arguments = args;
        }
        private ArgumentBase[] ParseArguments(XElement subEle)
        {
            IEnumerable <XElement> eleArgs = subEle.Elements();

            if (eleArgs == null || eleArgs.Count() == 0)
            {
                return(null);
            }
            ArgumentBase        arg  = null;
            List <ArgumentBase> args = new List <ArgumentBase>();

            foreach (XElement element in eleArgs)
            {
                if (element.Name == "ArgumentPair")
                {
                    arg = CreatArgumentPair(element);
                }
                else if (element.Name == "Argument")
                {
                    arg = CreatArgument(element);
                }
                else if (element.Name == "ArgumentGroup")
                {
                    arg = CreateArgumentGroup(element);
                }
                if (arg != null)
                {
                    args.Add(arg);
                }
            }
            return(args.ToArray());
        }
Beispiel #3
0
        private Dictionary <string, object> ReadAlgShareArg()
        {
            //by chennan 无共享参数情况错误
            if (_argumentProvider.ArgNames == null || _argumentProvider.ArgNames.Length == 0)
            {
                return(null);
            }
            Dictionary <string, object> algShare = new Dictionary <string, object>();

            foreach (string argName in _argumentProvider.ArgNames)
            {
                ArgumentBase argDef = _argumentProvider.GetArgDef(argName);
                if (argDef != null && argDef.IsAlgorithmShare)
                {
                    algShare.Add(argName, _argumentProvider.GetArg(argName));
                }
            }
            return(algShare);
        }