コード例 #1
0
ファイル: FormLibrary.cs プロジェクト: hebskjcc/OpenR8-1
        public void resetButton()
        {
            foreach (Button b in buttons)
            {
                b.Dispose();
            }
            buttons.Clear();
            buttonsLocationY = buttonStartY;

            //labels

            foreach (Label l in labels)
            {
                l.Dispose();
            }
            labels.Clear();

            //urls
            functionsURL.Clear();

            int           functionGroupNum = 0;
            int           functionNum      = 0;
            StringBuilder str  = new StringBuilder(R7.STRING_SIZE);
            StringBuilder str2 = new StringBuilder(R7.STRING_SIZE);

            functionGroupNum = R8.GetFunctionGroupNum();

            //20170124 leo: 加入 BrainVersion
            R7.GetVersion(str, R7.STRING_SIZE);
            //addLabel("version:" + str.ToString());
            buttonsLocationY += 5;

            for (int i = 0; i < functionGroupNum; i++)
            {
                R8.GetFunctionGroupName(str, R7.STRING_SIZE, i);
                addLabel(str.ToString());//GroupName
                functionNum = R8.GetFunctionNumInGroup(i);
                for (int j = 0; j < functionNum; j++)
                {
                    R8.GetFunctionName(str, R7.STRING_SIZE, i, j);
                    R8.GetFunctionDoc(str2, R7.STRING_SIZE, i, j);
                    //System.Console.WriteLine("getURL:" + str2);
                    if (isInSearchMode)
                    {
                        if (str.ToString().ToLower().Contains(textBoxSearch.Text.ToLower()))
                        {
                            addButton(str.ToString(), str2.ToString());
                        }
                    }
                    else
                    {
                        addButton(str.ToString(), str2.ToString());
                    }
                }
            }
            str.Clear();
            str2.Clear();
            this.Text = str_Libraries + "  " + buttons.Count + " of " + allFunctionCount;
            return;
        }
コード例 #2
0
ファイル: FormLibrary.cs プロジェクト: hebskjcc/OpenR8-1
        private void loadButtons()
        {
            allFunctionCount = 0;
            //addButton("OpenImage", "OpenImage");
            //addButton("SaveImage", "SaveImage");
            //addButton("DebugImage", "DebugImage");
            //addButton("Binarize", "Binarize");
            //20170123 leo : 改為從 function list 的 json 檔案 動態產生

            buttonsLocationY = buttonStartY;

            int           functionGroupNum = 0;
            int           functionNum      = 0;
            StringBuilder str  = new StringBuilder(R7.STRING_SIZE);
            StringBuilder str2 = new StringBuilder(R7.STRING_SIZE);

            functionGroupNum = R8.GetFunctionGroupNum();

            //20170124 leo: 加入 BrainVersion
            R7.GetVersion(str, R7.STRING_SIZE);
            //addLabel("version:" + str.ToString());
            buttonsLocationY += 5;

            functionURL.Clear();
            for (int i = 0; i < functionGroupNum; i++)
            {
                R8.GetFunctionGroupName(str, R7.STRING_SIZE, i);
                addLabel(str.ToString());//GroupName
                functionNum = R8.GetFunctionNumInGroup(i);
                for (int j = 0; j < functionNum; j++)
                {
                    allFunctionCount++;
                    R8.GetFunctionName(str, R7.STRING_SIZE, i, j);
                    R8.GetFunctionDoc(str2, R7.STRING_SIZE, i, j);
                    //System.Console.WriteLine("getURL:" + str2);
                    addButton(str.ToString(), str2.ToString());

                    //20170603 leo: 增加 "如果 function 有說明 URL ,在右方 function 小視窗中的右下方顯示 help 按鈕。"
                    //所以有url 連結的 name 要存起來
                    functionURL.Add(str.ToString(), str2.ToString());
                }
            }
            str.Clear();
            str2.Clear();
            return;
        }
コード例 #3
0
ファイル: Function.cs プロジェクト: hebskjcc/OpenR8-1
        //20170117 leo: 今天討論後, Function 預設裡面不塞 Data ,但[parameters 的格子] 留著
        //暫時開一個接 Parameters 的結構。以後這個應該會從 json 接。
        //20170123 leo : 改成從 json 接
        public static List <Parameter> getFunctionParameters(string name)
        {
            List <Parameter> args = new List <Parameter>();

            /*
             * switch (name)
             * {
             *  case "OpenImage":
             *      args.Add(new Parameter("Image File Name", R8.getDataTypeByString("string"), true));
             *      args.Add(new Parameter("Image ", R8.getDataTypeByString("image"), false));
             *      break;
             *  case "SaveImage":
             *      //arg1: (input, mat) image
             *      //arg2: (input, string) imagePath
             *      args.Add(new Parameter("Image", R8.getDataTypeByString("image"), true));
             *      args.Add(new Parameter("Image File Name", R8.getDataTypeByString("string"), true));
             *      break;
             *  case "Binarize":
             *      //cv::threshold(image, thresholdedImage, gv, 255, type);
             *
             *      args.Add(new Parameter("Input Image", R8.getDataTypeByString("image"), true));
             *      args.Add(new Parameter("Threshold", R8.getDataTypeByString("int"), true));
             *      //args.Add(new Parameter("thresholdType", Data.VariableType.Int, true));//對應 cv::threshold 的 type 參數
             *      args.Add(new Parameter("Output Image", R8.getDataTypeByString("image"), false));
             *      break;
             * }*/
            //20170123 leo : 改從 json 接
            int           functionGroupNum = 0;
            int           functionNum      = 0;
            int           variableNum      = 0;
            StringBuilder str = new StringBuilder(R7.STRING_SIZE);

            functionGroupNum = R8.GetFunctionGroupNum();
            string tempNameString;

            for (int i = 0; i < functionGroupNum; i++)
            {
                functionNum = R8.GetFunctionNumInGroup(i);
                for (int j = 0; j < functionNum; j++)
                {
                    R8.GetFunctionName(str, R7.STRING_SIZE, i, j);
                    //addButton(str.ToString());
                    if (str.ToString().Equals(name))
                    {
                        variableNum = R8.GetVariableNumInFunction(i, j);
                        for (int k = 0; k < variableNum; k++)
                        {
                            R8.GetVariableNameInFunction(str, R7.STRING_SIZE, i, j, k);
                            tempNameString = str.ToString();
                            R8.GetVariableTypeInFunction(str, R7.STRING_SIZE, i, j, k);
                            Parameter parameter = new Parameter(tempNameString, R8.getVariableTypeByString(str.ToString()));
                            //20170214 加入 Direction
                            //20171024 Direction 變成 Option
                            //option
                            R8.GetVariableOptionInFunction(str, R7.STRING_SIZE, i, j, k);
                            parameter.option = str.ToString();
                            args.Add(parameter);

                            //GetVariableDirectionInFunction
                        }
                    }
                }
            }
            str.Clear();
            return(args);
        }