GetSegmentationLabelId() public method

public GetSegmentationLabelId ( Vector2 p ) : uint
p Vector2
return uint
Esempio n. 1
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;
                        }
                    }
                }
            }
        }
Esempio n. 2
0
        public override void OnMouseDown(System.Windows.Forms.MouseEventArgs mouseEventArgs, int width, int height)
        {
            base.OnMouseDown(mouseEventArgs, width, height);
            if (mTileManager.CurrentSplitMode != SplitMode.JoinPoints)
            {
                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 (clickedId == mTileManager.SelectedSegmentId && mTileManager.CurrentSplitMode != SplitMode.JoinPoints)
                    {
                        mCurrentlyDrawing = true;

                        if (mTileManager.CurrentSplitMode == SplitMode.DrawSplit)
                        {
                            if (mouseEventArgs.Button == MouseButtons.Left)
                            {
                                mTileManager.DrawSplit(p);
                                mEngine.QuickRender();
                            }
                            else if (mouseEventArgs.Button == MouseButtons.Right)
                            {
                                mTileManager.DrawErase(p);
                                mEngine.QuickRender();
                            }
                        }
                        else if (mTileManager.CurrentSplitMode == SplitMode.DrawRegions)
                        {
                            if (mouseEventArgs.Button == MouseButtons.Left)
                            {
                                mTileManager.DrawRegionA(p);
                                mEngine.QuickRender();
                            }
                            else if (mouseEventArgs.Button == MouseButtons.Right)
                            {
                                mTileManager.DrawRegionB(p);
                                mEngine.QuickRender();
                            }
                        }
                    }
                }
            }
        }
Esempio n. 3
0
        public virtual void OnMouseDoubleClick(System.Windows.Forms.MouseEventArgs mouseEventArgs, int width, int height)
        {
            if (mTileManager.SegmentationLoaded && !mTileManager.SegmentationChangeInProgress && mouseEventArgs.Button == System.Windows.Forms.MouseButtons.Left)
            {
                //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);

                mEngine.CenterAndZoomToSegment2D(clickedId);
            }
        }
Esempio n. 4
0
        public override void OnMouseClick(System.Windows.Forms.MouseEventArgs mouseEventArgs, int width, int height)
        {
            if (mTileManager.SegmentationLoaded && !mTileManager.SegmentationChangeInProgress && mTileManager.SelectedSegmentId == 0)
            {
                //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 (clickedId > 0 && mouseEventArgs.Button != MouseButtons.Middle)
                {
                    //
                    // Select this segment
                    //
                    mTileManager.SelectedSegmentId = clickedId;
                    mTileManager.PrepForAdjust(p);
                }
            }
        }