Ejemplo n.º 1
0
 private void 逐点插入法ToolStripMenuItem_Click(object sender, EventArgs e)
 {
     //交互-格网与TIN
     if (逐点插入法ToolStripMenuItem.Checked == true)
     {
         //修改显示
         this.UserOperation = UserOperationType.DisplayInTIN;
         this.ShowTin       = true;
         this.显示隐藏TINToolStripMenuItem.Checked = true;
         CreateTIN createTin = new CreateTIN(this.mPointSet);
         Edge[]    tinEdges  = createTin.PointByPointInsertion2();
         Edge[]    tinEdges2 = createTin.GeneTIN().ToArray();
         TinEdges = tinEdges;
         TriangleSet triSet  = EdgeSet.TopologyGenerateTriangleSet(tinEdges, mPointSet);
         Triangle[]  triList = triSet.TriangleList.ToArray();
         TinContourLinePen.DashStyle = System.Drawing.Drawing2D.DashStyle.Dash;
         agisControl.Refresh();
     }
     else
     {
         //修改显示
         this.UserOperation = UserOperationType.None;
         this.ShowTin       = false;
         this.显示隐藏TINToolStripMenuItem.Checked = false;
     }
 }
Ejemplo n.º 2
0
        private void  方位加权平均法ToolStripMenuItem_Click(object sender, EventArgs e)
        {
            //this.agisControl.SetUserOperationToDisplayInGrid();
            if (agisControl.PointSet == null)
            {
                return;
            }
            int tempPara = agisControl.方位加权平均法SectorNum;

            if (tempPara < 0)
            {
                tempPara = Math.Max(agisControl.PointSet.PointList.Count / 8, 1);
            }
            GridIntParaForm form = new GridIntParaForm("每个象限等分的no个扇区", tempPara, 1,
                                                       Math.Max(agisControl.PointSet.PointList.Count / 4, 1));

            if (form.ShowDialog(this) == DialogResult.OK)
            {
                this.UserOperation               = UserOperationType.DisplayInGrid;
                this.agisControl.GridIntMethod   = Mehtod.GridInterpolationMehtod.方位加权平均法;
                方位加权平均法ToolStripMenuItem.Checked = true;
                距离平方倒数法ToolStripMenuItem.Checked = false;
                agisControl.方位加权平均法SectorNum     = form.ParaValue * 4;
                MessageBox.Show("参数设置成功!", "提示");
            }
        }
Ejemplo n.º 3
0
        private void 生成格网ToolStripMenuItem_Click(object sender, EventArgs e)
        {
            this.IsGridVisible = true;
            this.显示隐藏格网ToolStripMenuItem.Checked = true;
            this.UserOperation = UserOperationType.DisplayInGrid;
            GenerateGridForm form = new GenerateGridForm(this.GridDivisionCount_X, this.GridDivisionCount_Y);

            if (form.ShowDialog(this) == DialogResult.OK)
            {
                this.GridDivisionCount_X = form.DivisionX;
                this.GridDivisionCount_Y = form.DivisionY;
                GridDivisionRefresh();
                this.agisControl.Refresh();
            }
        }
Ejemplo n.º 4
0
        private void 打开ToolStripMenuItem1_Click(object sender, EventArgs e)
        {
            OpenFileForm openFile = new OpenFileForm();

            if (openFile.ShowDialog() == DialogResult.OK)
            {
                mPointSet          = PointSet.ReadFromCSV(openFile.PointSetFileName);
                this.Width         = 1000;
                this.Height        = 800;
                this.UserOperation = UserOperationType.DisplayThePointSet;
                agisControl.LoadPointSet(mPointSet, 1.2);
                agisControl.Refresh();
            }
            return;
        }
Ejemplo n.º 5
0
        public FileReaderTypeDto Adapt(UserOperationType operation)
        {
            switch (operation)
            {
            case UserOperationType.ReadText:
                return(FileReaderTypeDto.TextFile);

            case UserOperationType.ReadXml:
                return(FileReaderTypeDto.XmlFile);

            case UserOperationType.ReadJson:
                return(FileReaderTypeDto.JsonFile);

            default:
                throw new ArgumentOutOfRangeException(nameof(operation), operation, null);
            }
        }
        protected Item GetDraggedItem(PointerEventData data)
        {
            ItemDragControl dragControl = data.pointerDrag.GetComponent <ItemDragControl> ();

            if (dragControl == null)
            {
                return(null);
            }

            Item item = null;

            UserOperationType operationType = data.pointerDrag.GetComponent <ItemDragControl> ().operationType;

            if (operationType == UserOperationType.LongPress)
            {
                item = dragControl.item;
            }
            return(item);
        }
Ejemplo n.º 7
0
        /// <summary>
        /// 判断用户本次点击事件操作类型的协程
        /// </summary>
        /// <returns>The user operation type.</returns>
        /// <param name="data">点击起始时刻的点击信息数据</param>
        /// <param name="longPressCallBack">长按事件回调.</param>
        private IEnumerator CheckUserOperationType(PointerEventData data, UserOperationCallBack longPressCallBack)
        {
            float pressTime = Time.realtimeSinceStartup;

            mOperationType = UserOperationType.ShortClick;

            Vector3 pointerWorldPos;

            Vector3[] worldCorners = new Vector3[4];

            (transform as RectTransform).GetWorldCorners(worldCorners);

            bool pointerInsideDetectSource = true;

            while (Time.realtimeSinceStartup - pressTime < minPressTimeToDrag)
            {
                RectTransformUtility.ScreenPointToWorldPointInRectangle(transform as RectTransform, Input.mousePosition, data.pressEventCamera, out pointerWorldPos);

                pointerInsideDetectSource = CheckPointerInsideDetectSource(worldCorners, pointerWorldPos);

                if (!pointerInsideDetectSource)
                {
                    mOperationType = UserOperationType.Cancel;
                    break;
                }

                yield return(null);
            }

            if (pointerInsideDetectSource)
            {
                mOperationType = UserOperationType.LongPress;

                OnUserLongPress(data);
            }

            checkOperationTypeCoroutine = null;
        }
Ejemplo n.º 8
0
 public Task SendAsync(UserOperationType type, params object[] args) => SendAsync(Operation.Create(type, args));
Ejemplo n.º 9
0
 public UserOperation(string name, int id, UserOperationType userOperationType)
 {
     this.name = name;
     this.id   = id;
     this.userOperationType = userOperationType;
 }
Ejemplo n.º 10
0
 public Task SendAsync(UserOperationType type, params object[] objs) => _downstream.SendAsync(Operation.Create(type, objs));
Ejemplo n.º 11
0
        public Tuple <string, UserRepositoryAccount> handleUserOperation(UserRepositoryAccount userRepositoryAccount,
                                                                         UserOperationType type)
        {
            string result = "";
            UserRepositoryAccount resultUserRepositoryAccount = userRepositoryAccount;

            switch (type)
            {
            case UserOperationType.CREATE_PUBLIC_REPOSITORY:
            {
                result = userRepositoryService.createUserRepository(RepositoryType.PUBLIC, userRepositoryAccount);
                resultUserRepositoryAccount = identifiedUserRepositoryAccount(userRepositoryAccount.User);
                break;
            }

            case UserOperationType.CREATE_PRIVATE_REPOSITORY:
            {
                result = userRepositoryService.createUserRepository(RepositoryType.PRIVATE, userRepositoryAccount);
                resultUserRepositoryAccount = identifiedUserRepositoryAccount(userRepositoryAccount.User);
                break;
            }

            case UserOperationType.LIST_OWN_REPOSITORIES:
            {
                result =
                    $"Your repositories:\n{String.Join("\n", userRepositoryService.listOwnRepositories(userRepositoryAccount).ToArray())}";
                resultUserRepositoryAccount = identifiedUserRepositoryAccount(userRepositoryAccount.User);
                break;
            }

            case UserOperationType.LIST_CLONED_REPOSITORIES:
            {
                result =
                    $"Your cloned repositories:\n{String.Join("\n", userRepositoryService.listClonedRepositories(userRepositoryAccount).ToArray())}";
                resultUserRepositoryAccount = identifiedUserRepositoryAccount(userRepositoryAccount.User);
                break;
            }

            case UserOperationType.LIST_CONTRIBUTED_REPOSITORIES:
            {
                var user = userService.getUser(userRepositoryAccount.User.Login);
                userRepositoryAccount = identifiedUserRepositoryAccount(user);
                result =
                    $"Repositories where you made contributions:\n{String.Join("\n", userRepositoryService.listContributedRepositories(userRepositoryAccount).ToArray())}";
                resultUserRepositoryAccount = identifiedUserRepositoryAccount(userRepositoryAccount.User);
                break;
            }

            case UserOperationType.LOG_OUT:
            {
                result = "Thank you for your work! See you later!";
                resultUserRepositoryAccount = logOut(userRepositoryAccount.User);
                break;
            }

            case UserOperationType.SIGN_IN:
            {
                resultUserRepositoryAccount = signIn();
                result = $"Welcome back {resultUserRepositoryAccount.User.Login}! You successfully signed in.";
                break;
            }

            case UserOperationType.SIGN_UP:
            {
                resultUserRepositoryAccount = signUp();
                result = "You successfully signed up";
                break;
            }

            case UserOperationType.LOOK_FOR_USER:
            {
                User existingUser                = lookForUser();
                var  userOwnRepositories         = existingUser.getOwnRepositories().Select(it => it.Name);
                var  userContributedRepositories = existingUser.getContributedRepositories().Select(it => it.Name);
                result = $"Found user:{existingUser.Login}" +
                         $"\nUser own repositories:\n{String.Join("\n", userOwnRepositories)}" +
                         $"\nUser contributed repositories:\n{String.Join("\n", userContributedRepositories)}";
                resultUserRepositoryAccount = identifiedUserRepositoryAccount(userRepositoryAccount.User);
                break;
            }

            case UserOperationType.LOOK_FOR_REPOSITORY:
            {
                RepositoryDetails repositoryDetails = repositoryService.getRepositoryDetails();
                result = $"Repository:{repositoryDetails.Name}\n" +
                         $"Owner:{repositoryDetails.OwnerName}\n" +
                         $"Branches:\n{String.Join("\n", repositoryDetails.Branches)}\n" +
                         $"Contributors:\n{String.Join("\n", repositoryDetails.Contributors)}";
                break;
            }

            case UserOperationType.SELECT_REPOSITORY:
            {
                var account = userRepositoryService.selectRepository(userRepositoryAccount);
                resultUserRepositoryAccount = identifiedUserRepositoryAccount(account.User);
                break;
            }

            case UserOperationType.LIST_ALL_PUBLIC_REPOSITORIES:
            {
                RepositoryCollection collection         = new PublicRepositoryCollection();
                RepositoryIterator   repositoryIterator = collection.RepositoryIterator();
                while (repositoryIterator.hasMore())
                {
                    Repository repository = repositoryIterator.getNext();
                    Console.WriteLine($"Repository:{repository.Name}, owner:{repository.Owner.Login}");
                }
                break;
            }

            case UserOperationType.LIST_RATING_REPOSITORIES:
            {
                RepositoryCollection collection         = new RatingRepositoryCollection(resultUserRepositoryAccount.User);
                RepositoryIterator   repositoryIterator = collection.RepositoryIterator();
                while (repositoryIterator.hasMore())
                {
                    Repository repository = repositoryIterator.getNext();
                    Console.WriteLine($"Repository:{repository.Name}, owner:{repository.Owner.Login}, rating:{repository.getRepositoryRating()}");
                }
                break;
            }

            default:
            {
                result = "Invalid user operation type";
                break;
            }
            }

            return(new Tuple <string, UserRepositoryAccount>(result, resultUserRepositoryAccount));
        }
Ejemplo n.º 12
0
 public UserOperationModel(UserOperationType userOperationType, UserAccessOperationType userAccessOperationType)
 {
     this.UserOperationType       = userOperationType;
     this.UserAccessOperationType = userAccessOperationType;
 }