public IActionResult OnGetRegionOtps(int id)
        {
            NewRegion model  = null;
            var       client = new HttpClient();
            var       task   = client.GetAsync("https://api.otps.go.th/api/Regions/" + id)
                               .ContinueWith((taskwithresponse) =>
            {
                var response   = taskwithresponse.Result;
                var jsonString = response.Content.ReadAsStringAsync();
                jsonString.Wait();
                model = JsonConvert.DeserializeObject <NewRegion>(jsonString.Result);
            });

            task.Wait();
            return(Ok(model));
        }
예제 #2
0
        public override bool Process()
        {
            List <Tuple <HTuple, HTuple, HTuple, HTuple> > TupleList = new List <Tuple <HTuple, HTuple, HTuple, HTuple> >();

            TupleList.Add(new Tuple <HTuple, HTuple, HTuple, HTuple>(In_VLine.Item1, In_VLine.Item2, In_VLine.Item3, In_VLine.Item4));
            TupleList.Add(new Tuple <HTuple, HTuple, HTuple, HTuple>(In_HLine.Item1, In_HLine.Item2, In_HLine.Item3, In_HLine.Item4));


            HTuple GeometryPose = new HTuple();

            GeometryPose[0] = In_CenterRow;
            GeometryPose[1] = In_CenterCol;
            GeometryPose[2] = In_Phi;

            //显示直线的矩形框
            HalconVision.Instance.DisplayLines(In_CamID, TupleList);    //显示Tia的参考线

            //利用参考线画出原来画的区域
            HOperatorSet.ReadRegion(out HObject OldRegion, @"VisionData\ToolData\Flag.reg");

            HalconVision.Instance.GetGeometryRegionBy2Lines(In_CamID, OldRegion, TupleList[0].Item1, TupleList[0].Item2, TupleList[0].Item3, TupleList[0].Item4,
                                                            TupleList[1].Item1, TupleList[1].Item2, TupleList[1].Item3, TupleList[1].Item4, GeometryPose, out HObject NewRegion);


            if (NewRegion.IsInitialized())
            {
                Out_Region = NewRegion.SelectObj(1);
                NewRegion.Dispose();
            }
            if (OldRegion.IsInitialized())
            {
                OldRegion.Dispose();
            }

            //显示结果



            return(true);
        }
예제 #3
0
 public void AcceptControlNewRegion(NewRegion newRegion, PrintContext parameter)
 {
     parameter.WriteLine("New Region");
 }
예제 #4
0
 public virtual void AcceptControlNewRegion(NewRegion newRegion, T parameter)
 {
     // intentionally left blank
 }
예제 #5
0
        /// <summary>
        /// Make new selection
        /// </summary>
        /// <param name="sender">The object that raised the event</param>
        /// <param name="e">Event args</param>
        private void buttonRegion1_Click(object sender, EventArgs e)
        {
            NewRegion ee = new NewRegion(AddNewSection);

            ee.Show();
        }