Exemplo n.º 1
0
    void change_go_pose()
    {
        PoseInfo pi = press_pen.getCameraPose();

        this.gameObject.transform.localPosition = pi.rt_mat.ExtractPosition().ScaleTo(press_pen.scale_parameter);
        this.gameObject.transform.localRotation = pi.rt_mat.ExtractRotation();
    }
        public async Task <IActionResult> PutPoseInfo(long id, PoseInfo poseInfo)
        {
            if (id != poseInfo.AgesInfoId)
            {
                return(BadRequest());
            }

            _context.Entry(poseInfo).State = EntityState.Modified;

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!PoseInfoExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(NoContent());
        }
        public async Task <IActionResult> UpdateOrCreatePoseInfo(PoseInfo poseInfo)
        {
            var id = poseInfo.AgesInfoId;

            if (!PoseInfoExists(id))
            {
                await PostPoseInfo(poseInfo);

                return(NoContent());
            }
            else
            {
                return(await PutPoseInfo(id, poseInfo));
            }
        }
Exemplo n.º 4
0
        public int Add(Node pNode, Matrix pMatrix, bool pLocalMatrix = false /*, bool pMultipleBindPose=true*/)
        {
            var match = poseInfos.FindIndex(pi => pi.Node == pNode);

            if (match >= 0)
            {
                if (poseInfos[match].Matrix != pMatrix)
                {
                    return(-1);
                }
                return(match);
            }

            var p = new PoseInfo(pNode, pMatrix, pLocalMatrix);

            poseInfos.Add(p);

            return(poseInfos.IndexOf(p));
        }
Exemplo n.º 5
0
        //创建写数据库请求
        private static async void TestWriteDb()
        {
            string url = "https://localhost:44358/api/PoseInfoes";

            int[]  agesIds = new int[] { 1, 2 };
            Random random  = new Random();

            while (!isStop)
            {
                foreach (var item in agesIds)
                {
                    Task.Run(async() =>
                    {
                        PoseInfo poseInfo = new PoseInfo()
                        {
                            AgesInfoId = item,
                            Date       = DateTime.Now.Date,
                            TimeDown   = random.Next(1, 3600),
                            TimeIn     = "08:35",
                            TimeLie    = random.Next(1, 7200),
                            TimeOther  = random.Next(1, 7200),
                            TimeSit    = random.Next(1, 7300),
                            TimeStand  = random.Next(1, 7200),
                            Status     = (byte)random.Next(0, 5),
                            IsAlarm    = false
                        };
                        string jsonResult               = JsonConvert.SerializeObject(poseInfo);
                        HttpContent httpContent         = new StringContent(jsonResult);
                        httpContent.Headers.ContentType = new System.Net.Http.Headers.MediaTypeHeaderValue("application/json");
                        try
                        {
                            var result = await httpClient.PutAsync(url + $"/{item}", httpContent);
                        }
                        catch (HttpRequestException e)
                        {
                            Console.WriteLine($"GetAgeds caught exception: {e.Message}");
                        }
                    });
                }
                await Task.Delay(2000);
            }
        }
        public async Task <ActionResult <PoseInfo> > PostPoseInfo(PoseInfo poseInfo)
        {
            _context.PoseInfos.Add(poseInfo);
            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateException)
            {
                if (PoseInfoExists(poseInfo.AgesInfoId))
                {
                    return(Conflict());
                }
                else
                {
                    throw;
                }
            }

            return(CreatedAtAction("GetPoseInfo", new { id = poseInfo.AgesInfoId }, poseInfo));
        }