RemapSegmentLabel() public method

public RemapSegmentLabel ( uint clickedId ) : void
clickedId uint
return void
Ejemplo n.º 1
0
        public override void OnMouseClick(System.Windows.Forms.MouseEventArgs mouseEventArgs, int width, int height)
        {
            if (mTileManager.SegmentationLoaded && !mTileManager.SegmentationChangeInProgress && !mCurrentlyDrawing)
            {
                //Get the id of the segment being clicked

                var p = new Vector2((float)mouseEventArgs.X / width, (float)mouseEventArgs.Y / height);

                var clickedId = mTileManager.GetSegmentationLabelId(p);

                if (mouseEventArgs.Button == MouseButtons.Left)
                {
                    //Select this segment
                    if (clickedId > 0)
                    {
                        if (clickedId != mTileManager.SelectedSegmentId)
                        {
                            //Select this segment
                            mTileManager.SelectedSegmentId = clickedId;
                            mTileManager.PrepForSplit(p);
                        }
                    }
                }
                else if (mouseEventArgs.Button == MouseButtons.Right)
                {
                    if (clickedId > 0 && clickedId == mTileManager.SelectedSegmentId && mTileManager.CurrentSplitMode == SplitMode.JoinPoints)
                    {
                        mTileManager.AddSplitSource(p);
                        mTileManager.DrawRegionB(p, 4);
                        mTileManager.FindBoundaryJoinPoints2D(p);
                    }
                    else if (clickedId > 0 && mTileManager.SelectedSegmentId > 0 && clickedId != mTileManager.SelectedSegmentId)
                    {
                        //
                        // Merge with the clicked segment in 2D ( try this out to see if it makes sense )
                        //
                        switch (mTileManager.CurrentMergeMode)
                        {
                        case MergeMode.Fill2D:
                            mTileManager.ReplaceSegmentationLabelCurrentSlice(clickedId, p);
                            break;

                        case MergeMode.Fill3D:
                            mTileManager.ReplaceSegmentationLabelCurrentConnectedComponent(clickedId, p);
                            break;

                        default:
                            mTileManager.RemapSegmentLabel(clickedId);
                            break;
                        }
                        mTileManager.PrepForSplit(p);
                    }
                }
            }
        }
Ejemplo n.º 2
0
        public override void OnMouseClick(System.Windows.Forms.MouseEventArgs mouseEventArgs, int width, int height)
        {
            if (mTileManager.SegmentationLoaded && !mTileManager.SegmentationChangeInProgress)
            {
                //Get the id of the segment being clicked

                var p = new Vector2((float)mouseEventArgs.X / width, (float)mouseEventArgs.Y / height);

                var clickedId = mTileManager.GetSegmentationLabelId(p);

                if (mouseEventArgs.Button == MouseButtons.Left)
                {
                    //Select this segment
                    if (clickedId > 0)
                    {
                        if (clickedId != mTileManager.SelectedSegmentId)
                        {
                            //Select this segment
                            mTileManager.SelectedSegmentId = clickedId;
                        }
                    }
                }
                else if (mouseEventArgs.Button == MouseButtons.Right)
                {
                    if (clickedId > 0 && mTileManager.SelectedSegmentId > 0 && clickedId != mTileManager.SelectedSegmentId)
                    {
                        //
                        // Perform the merge
                        //
                        switch (mTileManager.CurrentMergeMode)
                        {
                        case MergeMode.Fill2D:
                            mTileManager.ReplaceSegmentationLabelCurrentSlice(clickedId, p);
                            break;

                        case MergeMode.Fill3D:
                            mTileManager.ReplaceSegmentationLabelCurrentConnectedComponent(clickedId, p);
                            break;

                        default:
                            mTileManager.RemapSegmentLabel(clickedId);
                            break;
                        }
                    }
                }
            }
        }