Example #1
0
 public DetailsOutputModel(Preprocess preprocessing) : base(preprocessing)
 {
     if (preprocessing.RepositoryGitId != null)
     {
         GitModel = new GitCommitOutputModel()
         {
             GitId      = preprocessing.RepositoryGitId,
             Repository = preprocessing.RepositoryName,
             Owner      = preprocessing.RepositoryOwner,
             Branch     = preprocessing.RepositoryBranch,
             CommitId   = preprocessing.RepositoryCommitId
         };
     }
     if (!string.IsNullOrEmpty(preprocessing.ContainerImage) && !string.IsNullOrEmpty(preprocessing.ContainerTag))
     {
         ContainerImage = new ContainerImageOutputModel()
         {
             RegistryId   = preprocessing.ContainerRegistryId,
             RegistryName = preprocessing.ContainerRegistry.Name,
             Image        = preprocessing.ContainerImage,
             Tag          = preprocessing.ContainerTag
         };
     }
     EntryPoint = preprocessing.EntryPoint;
 }
        public async Task <IActionResult> Create([FromBody] CreateInputModel model)
        {
            //データの入力チェック
            if (!ModelState.IsValid)
            {
                return(JsonBadRequest("Invalid inputs."));
            }
            if (string.IsNullOrWhiteSpace(model.Name))
            {
                //名前に空文字は許可しない
                return(JsonBadRequest($"A name of Preprocessing is NOT allowed to set empty string."));
            }
            if (model.GitModel != null && model.GitModel.IsValid() == false)
            {
                return(JsonBadRequest($"The input about Git is not valid."));
            }

            Preprocess preprocessing = new Preprocess();
            var        errorResult   = await SetPreprocessDetailsAsync(preprocessing, model);

            if (errorResult != null)
            {
                return(errorResult);
            }

            preprocessRepository.Add(preprocessing);
            unitOfWork.Commit();

            return(JsonCreated(new IndexOutputModel(preprocessing)));
        }
Example #3
0
    void Process(params Item[] selectedItems)
    {
        if (selectedItems.Length == 0)
        {
            return;
        }

        var sb = new StringBuilder("");

        sb.Append("Artwork(s) below are going to be pre-processed.\n")
        .Append("Any mesh modifications made before will be discarded.\n")
        .Append("Continue ?\n");

        foreach (var i in selectedItems)
        {
            sb.AppendFormat("  {0}\n", i.name);
        }

        if (EditorUtility.DisplayDialog("Confirm pre-processing", sb.ToString(), "Continue!", "Think again..."))
        {
            foreach (var i in selectedItems)
            {
                try
                {
                    EditorUtility.DisplayProgressBar("Pre-process", i.name, 0);
                    Preprocess.Process(i.name, i.args);
                }
                catch (Exception e)
                {
                    Debug.LogException(e);
                }
            }
            EditorUtility.ClearProgressBar();
        }
    }
        public XmlElement GetResult()
        {
            //TODO
            XmlHelper h = new XmlHelper("<Definition />");

            h.SetAttribute(".", "Type", "DBHelper");
            h.AddElement(".", "Action", ServiceAction.Delete.ToString());

            XmlElement      sqlTmp  = h.AddElement(".", "SQLTemplate");
            XmlCDataSection section = sqlTmp.OwnerDocument.CreateCDataSection(this.txtSQLTemplate.Text);

            sqlTmp.AppendChild(section);

            h.AddElement(".", "RequestRecordElement", txtRequestElement.Text);

            ConditionList conditions = new ConditionList(this.txtConditionName.Text, this.txtConditionSource.Text, chkRequired.Checked);

            foreach (DataGridViewRow row in this.dgConditions.Rows)
            {
                Condition condition = Condition.Parse(row);
                conditions.Conditions.Add(condition);
            }
            h.AddElement(".", conditions.GetXml());

            if (this.Service.Variables.Count > 0)
            {
                XmlElement varElement = h.AddElement(".", "InternalVariable");
                foreach (IVariable v in this.Service.Variables)
                {
                    h.AddElement("InternalVariable", v.GetXml());
                }
            }

            if (this.Service.Converters.Count > 0)
            {
                XmlElement cvElement = h.AddElement(".", "Converters");
                foreach (IConverter c in this.Service.Converters)
                {
                    h.AddElement("Converters", c.Output());
                }
            }

            if (this.dgProcessor.Rows.Count > 0)
            {
                XmlElement proElement = h.AddElement(".", "Preprocesses");
                foreach (DataGridViewRow row in this.dgProcessor.Rows)
                {
                    Preprocess pp = row.Tag as Preprocess;
                    if (pp == null)
                    {
                        continue;
                    }

                    h.AddElement("Preprocesses", pp.GetXml());
                }
            }
            return(h.GetElement("."));
        }
        /// <summary>
        /// 引数の前処理インスタンスに、入力モデルの値を詰め込む。
        /// 成功時はnullを返す。エラーが発生したらエラー内容を返す。
        /// 事前に<see cref="CreateInputModel.GitModel"/>の入力チェックを行っておくこと。
        /// </summary>
        private async Task <IActionResult> SetPreprocessDetailsAsync(Preprocess preprocessing, CreateInputModel model)
        {
            long?  gitId      = null;
            string repository = null;
            string owner      = null;
            string branch     = null;
            string commitId   = null;

            if (model.GitModel != null)
            {
                gitId      = model.GitModel.GitId ?? CurrentUserInfo.SelectedTenant.DefaultGit?.Id;
                repository = model.GitModel.Repository;
                owner      = model.GitModel.Owner;
                branch     = model.GitModel.Branch;
                commitId   = model.GitModel.CommitId;
                //コミットIDが指定されていなければ、ブランチのHEADからコミットIDを取得する
                if (string.IsNullOrEmpty(commitId))
                {
                    commitId = await gitLogic.GetCommitIdAsync(gitId.Value, model.GitModel.Repository, model.GitModel.Owner, model.GitModel.Branch);

                    if (string.IsNullOrEmpty(commitId))
                    {
                        //コミットIDが特定できなかったらエラー
                        return(JsonNotFound($"The branch {branch} for {gitId.Value}/{model.GitModel.Owner}/{model.GitModel.Repository} is not found."));
                    }
                }
            }

            long?  registryId = null;
            string image      = null;
            string tag        = null;

            if (model.ContainerImage != null)
            {
                registryId = model.ContainerImage.RegistryId ?? CurrentUserInfo.SelectedTenant.DefaultRegistry?.Id;
                image      = model.ContainerImage.Image;
                tag        = model.ContainerImage.Tag;
            }

            preprocessing.Name                = model.Name;
            preprocessing.EntryPoint          = model.EntryPoint;
            preprocessing.ContainerRegistryId = registryId;
            preprocessing.ContainerImage      = image;
            preprocessing.ContainerTag        = tag; //latestは運用上使用されていないハズなので、そのまま直接代入
            preprocessing.RepositoryGitId     = gitId;
            preprocessing.RepositoryName      = repository;
            preprocessing.RepositoryOwner     = owner;
            preprocessing.RepositoryBranch    = branch;
            preprocessing.RepositoryCommitId  = commitId;
            preprocessing.Memo                = model.Memo;
            preprocessing.Cpu    = model.Cpu;
            preprocessing.Memory = model.Memory;
            preprocessing.Gpu    = model.Gpu;

            return(null);
        }
Example #6
0
 /// <summary>
 /// コンストラクタ
 /// </summary>
 /// <param name="preprocessing">前処理</param>
 public IndexOutputModel(Preprocess preprocessing) : base(preprocessing)
 {
     Id = preprocessing.Id;
     //DisplayId = preprocessing.DisplayId;
     Name   = preprocessing.Name;
     Memo   = preprocessing.Memo;
     Cpu    = preprocessing.Cpu;
     Memory = preprocessing.Memory;
     Gpu    = preprocessing.Gpu;
 }
Example #7
0
        private void drawPreprocessedGraph(MyGraph mg, WindowsFormsHost host)
        {
            Graph   gr_1 = new Graph();                                          //создание экземпляра класса для рисования графа
            GViewer gv_1 = new GViewer();                                        //создание экземпляра класса для просмотра графа

            mg.PreprocessedMatrix = Preprocess.doHomeomorphic(mg.InitialMatrix); //проведения предобработки
            mg.drawGraph(mg.PreprocessedMatrix, gr_1);                           //рисование графа (предобработанного)

            gv_1.ToolBarIsVisible = false;                                       //скрытие тул-бара просмотрщика графа
            gv_1.Graph            = gr_1;                                        //присовение компоненте просмотра, какой граф отрисовывать
            host.Child            = gv_1;                                        //присвоение хосту дочернего обьекта просмотрщика графов
        }
Example #8
0
        private void EditProcessorForm_Load(object sender, EventArgs e)
        {
            this.cboType.Items.AddRange(Enum.GetNames(typeof(PreprocessType)));

            Preprocess source = _row.Tag as Preprocess;

            if (source != null)
            {
                _preprocess                 = source;
                this.txtName.Text           = _preprocess.Name;
                this.txtSQL.Text            = _preprocess.SQL;
                this.txtInvalidMessage.Text = _preprocess.InvalidMessage;
                this.cboType.Text           = _preprocess.Type.ToString();
            }
        }
Example #9
0
        //----------------------------------------

        #region Public Methods
        public override object[] Compute(params object[] input)
        {
            object[] output;


            try // Apply preprocessing (input filtering)
            {
                Preprocess.Apply(input);
            }
            catch (Exception exception)
            {
                throw new Exception(
                          "Exception ocurred while appling Input processing", exception);
            }


            // Prepare for network calculation
            double[] doubleInput = Array.ConvertAll <object, double>(input,
                                                                     delegate(object o) { return((double)o); });


            // Calculate Network Answers
            double[] doubleOutput = Network.Compute(doubleInput);


            // Prepare for output post processing
            output = Array.ConvertAll <double, object>(doubleOutput,
                                                       delegate(double o) { return((object)o); });


            try // Apply postprocessing (output filtering)
            {
                Postprocess.Apply(output);
            }
            catch (Exception exception)
            {
                throw new Exception(
                          "Exception ocurred while appling Output processing", exception);
            }


            // Return final result
            return(output);
        }
        public Maybe <List <ExResult> > Start(string imgpath, string procpath, string configpath)
        {
            var img = LoadImage(imgpath);
            Func <Rectangle, double> boxsum = FnSumInsideBox(img.Data);     //여기서 에버리지로 할건지, 합으로 할껀지 정할 수 있다.

            var inspectrecipe = ToInspctRecipe(configpath);
            var poseq         = EstedChipPosAndEq(inspectrecipe);
            var esetedindex   = ToEstedIndex(poseq);

            var doproc = RunProcessing.Apply(img);

            var recp = File.ReadAllText(procpath);


            var resimg = Just(recp)
                         .Bind(RemoveHeadTail)
                         .Bind(ToFuncRecipeList)
                         .Bind(ToPreProcFuncs)
                         .Bind(Preprocess.Apply(img));

            if (!resimg.isJust)
            {
                return(None);
            }


            var resisp1 = ToBoxList(inspectrecipe, resimg.Value);
            // 컨투어 찾고, 소팅후 박스로 (끝)


            var resGenerator = ToExResult(inspectrecipe, boxsum, poseq, resisp1.Value);
            // 박스 리스트에 대해 대응되는 인덱싱 리스트 (끝) 여기까지 체크 완료.

            var exresults = ResultInitializer(inspectrecipe) // 인덱싱 초기화만 되있음.
                            .Map(resGenerator)
                            .Flatten()
                            .ToList();     // 끝 여기서 모든 결과를 만들었다. (끝)\

            //var counter = exresults.Where(x => x.OKNG == "OK").Count();

            return(Just(exresults));
        }
Example #11
0
        /// <summary>
        /// This is the method that actually does the work.
        /// </summary>
        /// <param name="DA">The DA object is used to retrieve from inputs and store in outputs.</param>
        protected override void SolveInstance(IGH_DataAccess DA)
        {
            Double tol = 0.001;

            var    pts     = new List <Point3d>();
            Curve  ftCurve = null;
            Double height  = 0;

            DA.GetDataList(0, pts);
            DA.GetData(1, ref ftCurve);
            DA.GetData(2, ref height);

            Preprocess prep = new Preprocess(pts, ftCurve, height, tol);

            prep.Solve();

            DA.SetDataList(0, prep.ptInBox);
            DA.SetData(1, prep.extrusion);
            DA.SetData(2, prep.meshInBox);
        }
Example #12
0
        private void btnOK_Click(object sender, EventArgs e)
        {
            PreprocessType type;

            if (!Enum.TryParse <PreprocessType>(cboType.Text, true, out type))
            {
                type = PreprocessType.Variable;
            }

            Preprocess p = Preprocess.Create(txtName.Text, type, txtSQL.Text, txtInvalidMessage.Text);

            _row.Tag = p;

            _row.Cells[0].Value = p.Type.ToString();
            _row.Cells[1].Value = p.Name;
            _row.Cells[2].Value = p.SQL;
            _row.Cells[3].Value = p.InvalidMessage;

            _saved = true;
            this.Close();
        }
        public async Task <IActionResult> Create([FromBody] CreateInputModel model)
        {
            // データの入力チェック
            if (!ModelState.IsValid)
            {
                return(JsonBadRequest("Invalid inputs."));
            }
            if (string.IsNullOrWhiteSpace(model.Name))
            {
                // 名前に空文字は許可しない
                return(JsonBadRequest($"A name of Preprocessing is NOT allowed to set empty string."));
            }
            if (model.GitModel != null && model.GitModel.IsValid() == false)
            {
                return(JsonBadRequest($"The input about Git is not valid."));
            }
            // 各リソースの超過チェック
            Tenant tenant       = tenantRepository.Get(CurrentUserInfo.SelectedTenant.Id);
            string errorMessage = clusterManagementLogic.CheckQuota(tenant, model.Cpu, model.Memory, model.Gpu);

            if (errorMessage != null)
            {
                return(JsonBadRequest(errorMessage));
            }

            Preprocess preprocessing = new Preprocess();
            var        errorResult   = await SetPreprocessDetailsAsync(preprocessing, model);

            if (errorResult != null)
            {
                return(errorResult);
            }

            preprocessRepository.Add(preprocessing);
            unitOfWork.Commit();

            return(JsonCreated(new IndexOutputModel(preprocessing)));
        }
 private void preprocess_Click(object sender, RoutedEventArgs e)
 {
     Preprocess?.Invoke();
 }
Example #15
0
        /// <summary>
        /// ページをリロードします。
        /// </summary>
        /// <param name="frame">フレームのインスタンス</param>
        /// <param name="page">ページのインスタンス</param>
        /// <param name="preprocess">リロードの前処理 (async)</param>
        /// <param name="postprocess">リロードの後処理 (async)</param>
        /// <returns></returns>
        public static void Reload(Windows.UI.Xaml.Controls.Frame frame, Windows.UI.Xaml.Controls.Page page, Preprocess preprocess = null, Postprocess postprocess = null)
        {
            Logging.SysLogWriteWaiting = true;

            // 前処理
            if (preprocess != null)
            {
                preprocess(frame, page);
            }

            // コンポーネント再構築
            Windows.UI.Xaml.Application.LoadComponent(page, page.BaseUri, Windows.UI.Xaml.Controls.Primitives.ComponentResourceLocation.Application);

            // 後処理
            if (postprocess != null)
            {
                postprocess(frame, page);
            }

            Logging.SysLogWriteWaiting = false;
        }
        public XmlElement GetResult()
        {
            //TODO
            XmlHelper h = new XmlHelper("<Definition />");

            h.SetAttribute(".", "Type", "DBHelper");
            h.AddElement(".", "Action", ServiceAction.Set.ToString());

            h.AddElement(".", "RequestRecordElement", txtRequestElement.Text);
            h.AddElement(".", "TargetTableName", cboTable.Text);
            h.AddElement(".", "Mappings");
            XmlElement    dfmElement = h.AddElement("Mappings", "DefaultMapping");
            StringBuilder sb         = new StringBuilder("select ");

            foreach (DataGridViewRow row in this.dgFieldList.Rows)
            {
                bool autoNumber = this.GetBooleanValue(row.Cells[colAutoNumber.Name]);
                if (autoNumber)
                {
                    string target = row.Cells[colTarget.Name].Value + string.Empty;
                    string source = row.Cells[colSource.Name].Value + string.Empty;
                    sb.Append("\"").Append(target).Append("\" as \"").Append(source).Append("\"");
                    break;
                }
            }
            foreach (DataGridViewRow row in this.dgFieldList.Rows)
            {
                bool identity = this.GetBooleanValue(row.Cells[colIdentity.Name]);
                if (!identity)
                {
                    continue;
                }

                string target = row.Cells[colTarget.Name].Value + string.Empty;
                //string source = row.Cells[colSource.Name].Value + string.Empty;
                sb.Append(", \"").Append(target).Append("\"");
                //sb.Append(", \"").Append(target).Append("\" as \"").Append(source).Append("\"");
            }
            sb.Append(" from ").Append(cboTable.Text);
            XmlNode node = dfmElement.OwnerDocument.CreateCDataSection(sb.ToString());

            dfmElement.AppendChild(node);

            XmlElement fieldListElement = h.AddElement(".", "FieldList");

            fieldListElement.SetAttribute("Source", txtFieldListSource.Text);
            foreach (DataGridViewRow row in this.dgFieldList.Rows)
            {
                XmlElement fieldElement = h.AddElement("FieldList", "Field");
                string     source       = row.Cells[colSource.Name].Value + string.Empty;
                fieldElement.SetAttribute("Source", source);

                string target = row.Cells[colTarget.Name].Value + string.Empty;
                fieldElement.SetAttribute("Target", target);

                bool required = this.GetBooleanValue(row.Cells[colRequired.Name]);
                if (required)
                {
                    fieldElement.SetAttribute("Required", "true");
                }

                bool autoNumber = this.GetBooleanValue(row.Cells[colAutoNumber.Name]);
                if (autoNumber)
                {
                    fieldElement.SetAttribute("AutoNumber", "true");
                }

                bool identity = this.GetBooleanValue(row.Cells[colIdentity.Name]);
                if (identity)
                {
                    fieldElement.SetAttribute("Identity", "true");
                }

                string converter = row.Cells[colConverter.Name].Value + string.Empty;
                if (!string.IsNullOrWhiteSpace(converter))
                {
                    fieldElement.SetAttribute("Converter", converter);
                }

                string sourceType = row.Cells[colSourceType.Name].Value + string.Empty;
                if (!string.Equals(sourceType, "Request", StringComparison.CurrentCultureIgnoreCase))
                {
                    fieldElement.SetAttribute("SourceType", sourceType);
                }

                bool quote = this.GetBooleanValue(row.Cells[colQuote.Name]);
                if (!quote)
                {
                    fieldElement.SetAttribute("Quote", "false");
                }
            }

            if (this.Service.Variables.Count > 0)
            {
                XmlElement varElement = h.AddElement(".", "InternalVariable");
                foreach (IVariable v in this.Service.Variables)
                {
                    h.AddElement("InternalVariable", v.GetXml());
                }
            }

            if (this.dgProcessor.Rows.Count > 0)
            {
                XmlElement proElement = h.AddElement(".", "Preprocesses");
                foreach (DataGridViewRow row in this.dgProcessor.Rows)
                {
                    Preprocess pp = row.Tag as Preprocess;
                    if (pp == null)
                    {
                        continue;
                    }

                    h.AddElement("Preprocesses", pp.GetXml());
                }
            }
            return(h.GetElement("."));
        }
Example #17
0
        public XmlElement GetResult()
        {
            //TODO
            XmlHelper h = new XmlHelper("<Definition />");

            h.SetAttribute(".", "Type", "DBHelper");
            h.AddElement(".", "Action", ServiceAction.Select.ToString());

            XmlElement      sqlTmp  = h.AddElement(".", "SQLTemplate");
            XmlCDataSection section = sqlTmp.OwnerDocument.CreateCDataSection(this.txtSQLTemplate.Text);

            sqlTmp.AppendChild(section);

            h.AddElement(".", "ResponseRecordElement", txtRequestElement.Text);
            FieldList fields = new FieldList(this.txtFieldListName.Text, this.txtFieldListSource.Text);

            foreach (DataGridViewRow row in this.dgFieldList.Rows)
            {
                Field f = Field.Parse(row);
                fields.Fields.Add(f);
            }
            h.AddElement(".", fields.GetXml(ServiceAction.Select));

            ConditionList conditions = new ConditionList(this.txtConditionName.Text, this.txtConditionSource.Text, chkRequired.Checked);

            foreach (DataGridViewRow row in this.dgConditions.Rows)
            {
                Condition condition = Condition.Parse(row);
                conditions.Conditions.Add(condition);
            }
            h.AddElement(".", conditions.GetXml());

            OrderList orders = new OrderList(txtOrderName.Text, txtOrderSource.Text);

            foreach (DataGridViewRow row in dgOrder.Rows)
            {
                string target = row.Cells[colOrderTarget.Name].Value + string.Empty;
                string source = row.Cells[colOrderSource.Name].Value + string.Empty;
                Order  o      = new Order(target, source);
                orders.Orders.Add(o);
            }
            h.AddElement(".", orders.GetXml());

            int max = 0;

            if (!int.TryParse(txtMaxPageSize.Text, out max))
            {
                max = 0;
            }
            Pagination p = new Pagination(chkAllowPagination.Checked, max);

            h.AddElement(".", p.GetXml());

            if (this.Service.Variables.Count > 0)
            {
                XmlElement varElement = h.AddElement(".", "InternalVariable");
                foreach (IVariable v in this.Service.Variables)
                {
                    h.AddElement("InternalVariable", v.GetXml());
                }
            }

            if (this.Service.Converters.Count > 0)
            {
                XmlElement cvElement = h.AddElement(".", "Converters");
                foreach (IConverter c in this.Service.Converters)
                {
                    h.AddElement("Converters", c.Output());
                }
            }

            if (this.dgProcessor.Rows.Count > 0)
            {
                XmlElement proElement = h.AddElement(".", "Preprocesses");
                foreach (DataGridViewRow row in this.dgProcessor.Rows)
                {
                    Preprocess pp = row.Tag as Preprocess;
                    if (pp == null)
                    {
                        continue;
                    }

                    h.AddElement("Preprocesses", pp.GetXml());
                }
            }
            return(h.GetElement("."));
        }
Example #18
0
 //Constructors
 public PreprocessComparer(Preprocess P, Comparison <TComp> C, Comparison <TComp> AltC)
 {
     this.P    = P;
     this.C    = C;
     this.AltC = AltC;
 }
Example #19
0
 public PreprocessComparer(Preprocess P, Comparison <TComp> C)
 {
     this.P = P;
     AltC   = this.C = C;
 }